MantisBase v0.3.4
Loading...
Searching...
No Matches
logger.h File Reference
#include <nlohmann/json.hpp>
#include <spdlog/spdlog.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <memory>
#include "log_database.h"
#include "../../utils/utils.h"
Include dependency graph for logger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mb::Logger
 
class  mb::FuncLogger
 A class for tracing function execution [entry, exit] useful in following execution flow. More...
 

Namespaces

namespace  mb
 router.h
 
namespace  mb::logEntry
 
namespace  mb::LogOrigin
 Utility logger functions for each component/system. These functions automatically pass the origin parameter.
 

Macros

#define MANTIS_FUNC()   std::format("{} - {}()", getFile(__FILE__), __FUNCTION__)
 
#define TRACE_FUNC(x)   mb::FuncLogger _logger(x);
 
#define TRACE_MANTIS_FUNC()   try{ mb::FuncLogger _logger(MANTIS_FUNC()); } catch(...){}
 
#define TRACE_CLASS_METHOD()   mb::FuncLogger _logger(std::format("{} {}::{}()", getFile(__FILE__), "", __FUNCTION__));
 
#define TRACE_METHOD()   mb::FuncLogger _logger(std::format("{} {}()", getFile(__FILE__), __FUNCTION__));
 

Typedefs

typedef enum mb::LogLevel mb::LogLevel
 

Enumerations

enum class  mb::LogLevel : uint8_t {
  mb::TRACE = 0 , mb::DEBUG , mb::INFO , mb::WARN ,
  mb::CRITICAL
}
 

Functions

std::string getFile (const std::string &path)
 

Macro Definition Documentation

◆ MANTIS_FUNC

#define MANTIS_FUNC ( )    std::format("{} - {}()", getFile(__FILE__), __FUNCTION__)

◆ TRACE_CLASS_METHOD

#define TRACE_CLASS_METHOD ( )    mb::FuncLogger _logger(std::format("{} {}::{}()", getFile(__FILE__), "", __FUNCTION__));

◆ TRACE_FUNC

#define TRACE_FUNC (   x)    mb::FuncLogger _logger(x);

◆ TRACE_MANTIS_FUNC

#define TRACE_MANTIS_FUNC ( )    try{ mb::FuncLogger _logger(MANTIS_FUNC()); } catch(...){}

◆ TRACE_METHOD

#define TRACE_METHOD ( )    mb::FuncLogger _logger(std::format("{} {}()", getFile(__FILE__), __FUNCTION__));

Function Documentation

◆ getFile()

std::string getFile ( const std::string &  path)
inline