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
20
21#include <os/log.h>
22
23namespace openvpn {
25{
26 public:
28
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;
49};
50} // namespace openvpn
51
52#endif
virtual void log(const std::string &str) override
RCPtr< LogBaseSimpleMac > Ptr
The smart pointer class.
Definition rc.hpp:119
The logging interface, simple, logs a string.
Scoped RAII for the global_log pointer.
os<< "Session Name: "<< tbc-> session_name<< '\n';os<< "Layer: "<< tbc-> layer str()<< '\n'