OMSim
Geant4 for IceCube optical module studies
Loading...
Searching...
No Matches
OMSimLogger.hh
1#pragma once
2#include <spdlog/spdlog.h>
3#include <spdlog/sinks/stdout_color_sinks.h>
4#include <memory>
5#include "spdlog/fmt/fmt.h"
6
7// Global logger instance
8extern std::shared_ptr<spdlog::logger> g_logger;
9
10// Custom logging function
11void customLog(spdlog::level::level_enum log_level, const char* file, int line, const char* func, const std::string& message);
12
13#define log_trace(...) customLog(spdlog::level::trace, __FILE__, __LINE__, __func__, fmt::format(__VA_ARGS__))
14#define log_debug(...) customLog(spdlog::level::debug, __FILE__, __LINE__, __func__, fmt::format(__VA_ARGS__))
15#define log_info(...) customLog(spdlog::level::info, __FILE__, __LINE__, __func__, fmt::format(__VA_ARGS__))
16#define log_notice(...) customLog(spdlog::level::info, __FILE__, __LINE__, __func__, fmt::format(__VA_ARGS__))
17#define log_warning(...) customLog(spdlog::level::warn, __FILE__, __LINE__, __func__, fmt::format(__VA_ARGS__))
18#define log_error(...) customLog(spdlog::level::err, __FILE__, __LINE__, __func__, fmt::format(__VA_ARGS__))
19#define log_critical(...) customLog(spdlog::level::critical, __FILE__, __LINE__, __func__, fmt::format(__VA_ARGS__))