VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
Logger.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
30//=======================================================================================
31#ifndef VF_LOGGER_H
32#define VF_LOGGER_H
33
34// VirtualFluids is using the spdlog logger https://github.com/gabime/spdlog
35#include <spdlog/spdlog.h>
36// To initialize spdlog initializeLogger() must be called.
37// spdlog supports 5 log level, which can be changed at runtime e.g.:
38// spdlog::set_level(spdlog::level::debug)
39// The default log level is set to trace. Supported levels: trace < debug < info < warning < critical
40//
41// The logging is realized in 3 different log sinks:
42// 1. colored console output
43// 2. a daily log file
44// 3. a log file from the last run of VirtualFluids
45// The default file path is relative to executed command logs/
46// File path can be changed via changeLogPath()
47
48#define VF_LOG_TRACE(...) spdlog::trace(__VA_ARGS__)
49#define VF_LOG_DEBUG(...) spdlog::debug(__VA_ARGS__)
50#define VF_LOG_INFO(...) spdlog::info(__VA_ARGS__)
51#define VF_LOG_WARNING(...) spdlog::warn(__VA_ARGS__)
52#define VF_LOG_CRITICAL(...) spdlog::critical(__VA_ARGS__)
53
54namespace vf::logging
55{
56class Logger
57{
58public:
59 // initializing the above named logger
60 static void initializeLogger();
61
62 // changing the path of the log files
63 static void changeLogPath(std::string path);
64
65private:
66 static void updateDefaultLogger();
67
68 static std::string logPath;
69};
70
71} // namespace vf::logging
72
73#endif
static void initializeLogger()
Definition Logger.cpp:43
static void changeLogPath(std::string path)
Definition Logger.cpp:59