OpenVPN 3 Core Library
Loading...
Searching...
No Matches
logdatetime.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// Simple logging with data/time prepend
13
14#pragma once
15
16#include <iostream>
18
19#ifndef OPENVPN_LOG_STREAM
20#define OPENVPN_LOG_STREAM std::cout
21#endif
22
23#define OPENVPN_LOG(args) OPENVPN_LOG_STREAM << date_time() << ' ' << args << "\n" \
24 << std::flush
25
26// like OPENVPN_LOG but no trailing newline
27#define OPENVPN_LOG_NTNL(args) OPENVPN_LOG_STREAM << date_time() << ' ' << args
28
29#define OPENVPN_LOG_STRING(str) OPENVPN_LOG_STREAM << date_time() << ' ' << (str)
30
31// no-op constructs normally used with logthread.hpp
32namespace openvpn::Log {
33struct Context
34{
35 struct Wrapper
36 {
37 };
39 {
40 }
41};
42} // namespace openvpn::Log
Argument to construct a Context in a different thread.
Scoped RAII for the global_log pointer.
Context(const Wrapper &)