Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
logs.cpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
16
20#include "shamcomm/logs.hpp"
22#include <cmath>
23
24namespace shamcomm::logs {
25
27 // log level declared printer
29
31#define IsActivePrint(_name, StructREF) _name##_ln("xxx", "xxx", "(", "logger::" #_name, ")");
32
34 raw_ln("log status : ");
35 if (get_loglevel() == i8_max) {
36 raw_ln("If you've seen spam in your life i can garantee you, this is worst");
37 }
38
39 raw_ln(shambase::format(" - Loglevel: {}, enabled log types :", u32(get_loglevel())));
40
41// logger::raw_ln(terminal_effects::faint + "----------------------" + terminal_effects::reset);
42
44#define X IsActivePrint
46#undef X
47 // logger::raw_ln(terminal_effects::faint + "----------------------" +
48 // terminal_effects::reset);
49 }
50
51#undef IsActivePrint
52
53} // namespace shamcomm::logs
54
55std::string LogLevel_DebugAlloc::reformat(const std::string &in, std::string module_name) {
57}
58
59std::string LogLevel_DebugMPI::reformat(const std::string &in, std::string module_name) {
61}
62
63std::string LogLevel_DebugSYCL::reformat(const std::string &in, std::string module_name) {
66}
67
68std::string LogLevel_Debug::reformat(const std::string &in, std::string module_name) {
70}
71
72std::string LogLevel_Info::reformat(const std::string &in, std::string module_name) {
73 return logger::reformat_all(shambase::term_colors::col8b_cyan(), "Info", module_name, in);
74}
75
76std::string LogLevel_Normal::reformat(const std::string &in, std::string module_name) {
78}
79
80std::string LogLevel_Warning::reformat(const std::string &in, std::string module_name) {
82}
83
84std::string LogLevel_Error::reformat(const std::string &in, std::string module_name) {
86}
std::uint32_t u32
32 bit unsigned integer
std::string reformat_all(const std::string &color, const char *name, const std::string &module_name, const std::string &content)
Format a log message with all the information.
i8 get_loglevel()
Get the current global log level.
Definition loglevel.hpp:52
std::string reformat_simple(const std::string &color, const char *name, const std::string &module_name, const std::string &content)
Format a log message with the minimum information.
constexpr i8 i8_max
i8 max value
void print_active_level()
Prints the active log levels.
Definition logs.cpp:33
void raw_ln(Types... var2)
Prints a log message with multiple arguments followed by a newline.
Definition logs.hpp:90
#define LIST_LEVEL
X-macro for log level definition.
Definition logs.hpp:43
This file contains the definition for the stacktrace related functionality.
static constexpr const char * level_name
Log level name.
Definition loglevels.hpp:29
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for debugging memory allocation.
Definition logs.cpp:55
static constexpr const char * level_name
Log level name.
Definition loglevels.hpp:67
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for debugging MPI operations.
Definition logs.cpp:59
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for debugging SYCL operations.
Definition logs.cpp:63
static constexpr const char * level_name
Log level name.
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for debugging general operations.
Definition logs.cpp:68
static constexpr const char * level_name
Log level name.
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for error messages.
Definition logs.cpp:84
static constexpr const char * level_name
Log level name.
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for informational messages.
Definition logs.cpp:72
static constexpr const char * level_name
Log level name.
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for normal messages.
Definition logs.cpp:76
static constexpr const char * level_name
Log level name.
static std::string reformat(const std::string &in, std::string module_name)
Log formatter function for warning messages.
Definition logs.cpp:80
const std::string col8b_yellow()
Get the yellow terminal escape char.
const std::string col8b_magenta()
Get the magenta (pink) terminal escape char.
const std::string empty()
Get the empty terminal escape.
const std::string col8b_green()
Get the green terminal escape char.
const std::string col8b_blue()
Get the blue terminal escape char.
const std::string col8b_cyan()
Get the cyan terminal escape char.
const std::string col8b_red()
Get the red terminal escape char.
Functions related to the MPI communicator.