OpenVPN 3 Core Library
Loading...
Searching...
No Matches
logbasesimplemac.hpp
Go to the documentation of this file.
1
// OpenVPN -- An application to securely tunnel IP networks
2
// over a single port, with support for SSL/TLS-based
3
// session authentication and key exchange,
4
// packet encryption, packet authentication, and
5
// packet compression.
6
//
7
// Copyright (C) 2012- OpenVPN Inc.
8
//
9
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10
//
11
12
#ifndef OPENVPN_LOG_LOGBASESIMPLEMAC_H
13
#define OPENVPN_LOG_LOGBASESIMPLEMAC_H
14
15
#include <iostream>
16
#include <mutex>
17
18
#include <
openvpn/log/logbase.hpp
>
19
#include <
openvpn/time/timestr.hpp
>
20
21
#include <os/log.h>
22
23
namespace
openvpn
{
24
class
LogBaseSimpleMac
:
public
LogBase
25
{
26
public
:
27
typedef
RCPtr<LogBaseSimpleMac>
Ptr
;
28
29
LogBaseSimpleMac
()
30
:
log_context
(this)
31
{
32
os_log_with_type(OS_LOG_DEFAULT,
33
OS_LOG_TYPE_DEFAULT,
34
"LogBaseSimple for macOS/iOS initialized"
);
35
}
36
37
virtual
void
log
(
const
std::string &
str
)
override
38
{
39
std::lock_guard<std::mutex> lock(
mutex
);
40
os_log_with_type(OS_LOG_DEFAULT,
41
OS_LOG_TYPE_DEFAULT,
42
"OVPN-CORE: %{public}s"
,
43
str
.c_str());
44
}
45
46
private
:
47
std::mutex
mutex
;
48
Log::Context
log_context
;
49
};
50
}
// namespace openvpn
51
52
#endif
openvpn::LogBaseSimpleMac
Definition
logbasesimplemac.hpp:25
openvpn::LogBaseSimpleMac::LogBaseSimpleMac
LogBaseSimpleMac()
Definition
logbasesimplemac.hpp:29
openvpn::LogBaseSimpleMac::log
virtual void log(const std::string &str) override
Definition
logbasesimplemac.hpp:37
openvpn::LogBaseSimpleMac::Ptr
RCPtr< LogBaseSimpleMac > Ptr
Definition
logbasesimplemac.hpp:27
openvpn::LogBaseSimpleMac::log_context
Log::Context log_context
Definition
logbasesimplemac.hpp:48
openvpn::LogBaseSimpleMac::mutex
std::mutex mutex
Definition
logbasesimplemac.hpp:47
openvpn::RCPtr
The smart pointer class.
Definition
rc.hpp:119
logbase.hpp
openvpn
Definition
ovpncli.cpp:97
openvpn::LogBase
The logging interface, simple, logs a string.
Definition
logbase_class.hpp:26
openvpn::Log::Context
Scoped RAII for the global_log pointer.
Definition
logdatetime.hpp:33
str
os<< "Session Name: "<< tbc-> session_name<< '\n';os<< "Layer: "<< tbc-> layer str()<< '\n'
timestr.hpp
openvpn
log
logbasesimplemac.hpp
Generated by
1.9.8