Loading...
Searching...
No Matches
EonLogger.h File Reference
#include "quill/Backend.h"
#include "quill/Frontend.h"
#include "quill/LogMacros.h"
#include "quill/Logger.h"
#include "quill/sinks/ConsoleSink.h"
#include "quill/sinks/FileSink.h"
#include <atomic>
#include <chrono>
#include <filesystem>
#include <mutex>
#include <source_location>
#include <string>
#include <string_view>
#include <system_error>

Go to the source code of this file.

Classes

struct  eonc::log::Scoped
 RAII helper for class-scoped logging. More...
struct  eonc::log::FileScoped
 RAII helper for file-based logging in a class. More...

Namespaces

namespace  eonc
 RAII resource manager for the ARTn C library with global synchronization.
namespace  eonc::log
namespace  eonc::log::detail

Macros

#define EONC_EXPAND(x)
#define EONC_LOG_TRACE(...)
 Convenience macro for one-shot logging without storing a logger.
#define EONC_LOG_DEBUG(...)
#define EONC_LOG_INFO(...)
#define EONC_LOG_WARNING(...)
#define EONC_LOG_ERROR(...)
#define EONC_LOG_CRITICAL(...)

Functions

quill::Logger * eonc::log::init_client () noexcept
 Start the client backend and the combi / traceback loggers once.
quill::Logger * eonc::log::get () noexcept
 Get or create the default "combi" logger.
quill::Logger * eonc::log::traceback () noexcept
 Get or create the "_traceback" logger for traceback logging.
quill::Logger * eonc::log::get_file (std::string_view name, std::string_view filename, std::string_view pattern="%(message)")
 Get or create a named logger with a file sink.

Variables

constexpr std::string_view eonc::log::detail::kDefaultLoggerName {"combi"}
constexpr std::string_view eonc::log::detail::kTracebackLoggerName {"_traceback"}
constexpr std::chrono::milliseconds eonc::log::detail::kBackendSleep {1}
 Idle sleep of the client's logging backend thread.

Macro Definition Documentation

◆ EONC_EXPAND

#define EONC_EXPAND ( x)
Value:
x

Definition at line 294 of file EonLogger.h.

◆ EONC_LOG_CRITICAL

#define EONC_LOG_CRITICAL ( ...)
Value:
do { \
if (auto *l = eonc::log::get()) { \
EONC_EXPAND(QUILL_LOG_CRITICAL(l, __VA_ARGS__)); \
} \
} while (0)
quill::Logger * get() noexcept
Get or create the default "combi" logger.
Definition EonLogger.h:111

Definition at line 334 of file EonLogger.h.

334#define EONC_LOG_CRITICAL(...) \
335 do { \
336 if (auto *l = eonc::log::get()) { \
337 EONC_EXPAND(QUILL_LOG_CRITICAL(l, __VA_ARGS__)); \
338 } \
339 } while (0)

◆ EONC_LOG_DEBUG

#define EONC_LOG_DEBUG ( ...)
Value:
do { \
if (auto *l = eonc::log::get()) { \
EONC_EXPAND(QUILL_LOG_DEBUG(l, __VA_ARGS__)); \
} \
} while (0)

Definition at line 310 of file EonLogger.h.

310#define EONC_LOG_DEBUG(...) \
311 do { \
312 if (auto *l = eonc::log::get()) { \
313 EONC_EXPAND(QUILL_LOG_DEBUG(l, __VA_ARGS__)); \
314 } \
315 } while (0)

◆ EONC_LOG_ERROR

#define EONC_LOG_ERROR ( ...)
Value:
do { \
if (auto *l = eonc::log::get()) { \
EONC_EXPAND(QUILL_LOG_ERROR(l, __VA_ARGS__)); \
} \
} while (0)

Definition at line 328 of file EonLogger.h.

328#define EONC_LOG_ERROR(...) \
329 do { \
330 if (auto *l = eonc::log::get()) { \
331 EONC_EXPAND(QUILL_LOG_ERROR(l, __VA_ARGS__)); \
332 } \
333 } while (0)

◆ EONC_LOG_INFO

#define EONC_LOG_INFO ( ...)
Value:
do { \
if (auto *l = eonc::log::get()) { \
EONC_EXPAND(QUILL_LOG_INFO(l, __VA_ARGS__)); \
} \
} while (0)

Definition at line 316 of file EonLogger.h.

316#define EONC_LOG_INFO(...) \
317 do { \
318 if (auto *l = eonc::log::get()) { \
319 EONC_EXPAND(QUILL_LOG_INFO(l, __VA_ARGS__)); \
320 } \
321 } while (0)

◆ EONC_LOG_TRACE

#define EONC_LOG_TRACE ( ...)
Value:
do { \
if (auto *l = eonc::log::get()) { \
EONC_EXPAND(QUILL_LOG_TRACE_L1(l, __VA_ARGS__)); \
} \
} while (0)

Convenience macro for one-shot logging without storing a logger.

Use when you only need to log once or twice in a function and don't want to declare a logger variable.

Example: EONC_LOG_INFO("quick message"); EONC_LOG_DEBUG("value: {}", x);

Definition at line 304 of file EonLogger.h.

304#define EONC_LOG_TRACE(...) \
305 do { \
306 if (auto *l = eonc::log::get()) { \
307 EONC_EXPAND(QUILL_LOG_TRACE_L1(l, __VA_ARGS__)); \
308 } \
309 } while (0)

◆ EONC_LOG_WARNING

#define EONC_LOG_WARNING ( ...)
Value:
do { \
if (auto *l = eonc::log::get()) { \
EONC_EXPAND(QUILL_LOG_WARNING(l, __VA_ARGS__)); \
} \
} while (0)

Definition at line 322 of file EonLogger.h.

322#define EONC_LOG_WARNING(...) \
323 do { \
324 if (auto *l = eonc::log::get()) { \
325 EONC_EXPAND(QUILL_LOG_WARNING(l, __VA_ARGS__)); \
326 } \
327 } while (0)