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 << std::endl
24
25// like OPENVPN_LOG but no trailing newline
26#define OPENVPN_LOG_NTNL(args) OPENVPN_LOG_STREAM << date_time() << ' ' << args
27
28#define OPENVPN_LOG_STRING(str) OPENVPN_LOG_STREAM << date_time() << ' ' << (str)
29
30// no-op constructs normally used with logthread.hpp
31namespace openvpn::Log {
32struct Context
33{
34 struct Wrapper
35 {
36 };
38 {
39 }
40};
41} // namespace openvpn::Log
Argument to construct a Context in a different thread.
Scoped RAII for the global_log pointer.
Context(const Wrapper &)