Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
logger.h File Reference

The main file for the logger. More...

#include <utils/config.h>
#include <plugins/event.h>
#include <cstdarg>
#include <ctime>

Go to the source code of this file.

Classes

class  logger::PostPrintEvent
 Post print event. More...
 

Namespaces

namespace  logger
 The logging namespace.
 

Macros

#define RESET_COLOR   "\033[0m"
 ANSI reset color.
 
#define TIME_COLOR   "\033[0;90m"
 ANSI color for time in the console.
 
#define FATAL_COLOR   "\033[1;31m"
 ANSI color for fatal level in the console.
 
#define ERROR_COLOR   "\033[0;31m"
 ANSI color for error level in the console.
 
#define WARN_COLOR   "\033[0;33m"
 ANSI color for warn level in the console.
 
#define PLUGIN_COLOR   "\033[0;34m"
 ANSI color for plugins.
 
#define INFO_COLOR   "\033[0;35m"
 ANSI color for info level in the console.
 
#define DEBUG_COLOR   "\033[0;36m"
 ANSI color for debug level in the console.
 

Enumerations

enum  LogLevel : std::uint8_t {
  ALL = 0 , DEBUG = 1 , INFO = 2 , PLUGIN = 3 ,
  WARN = 3 , ERROR = 4 , FATAL = 5 , OFF = 6
}
 The LogLevel used internally by the logger. More...
 

Functions

std::string logger::getTime ()
 Get the Time as a string.
 
void logger::loadConfig ()
 Loads the loglevel from the config.
 
void logger::debug (const char *format,...)
 Logs something at the DEBUG level.
 
void logger::info (const char *format,...)
 Logs something at the INFO level.
 
void logger::plugin (const char *format,...)
 Logs something at the PLUGIN level, for plugins.
 
void logger::warn (const char *format,...)
 Logs something at the WARN level.
 
void logger::error (const char *format,...)
 Logs something at the ERROR level.
 
void logger::fatal (const char *format,...)
 Logs something at the FATAL level.
 

Detailed Description

The main file for the logger.

Author
Lygaen
Version
1.0
Date
2023-03-20

Macro Definition Documentation

◆ DEBUG_COLOR

#define DEBUG_COLOR   "\033[0;36m"

ANSI color for debug level in the console.

See logger::debug() for more info

◆ ERROR_COLOR

#define ERROR_COLOR   "\033[0;31m"

ANSI color for error level in the console.

See logger::error() for more info

◆ INFO_COLOR

#define INFO_COLOR   "\033[0;35m"

ANSI color for info level in the console.

See logger::info() for more info

◆ PLUGIN_COLOR

#define PLUGIN_COLOR   "\033[0;34m"

ANSI color for plugins.

See logger::plugin() for more info

◆ TIME_COLOR

#define TIME_COLOR   "\033[0;90m"

ANSI color for time in the console.

See logger::getTime() for more info

◆ WARN_COLOR

#define WARN_COLOR   "\033[0;33m"

ANSI color for warn level in the console.

See logger::warn() for more info

Enumeration Type Documentation

◆ LogLevel

The LogLevel used internally by the logger.

The standard log levels in an enum, only used internally by the logger.

Enumerator
ALL 

All level, just for enabling.

Enables all possible log levels

DEBUG 

Debug level.

see logger::debug() for more info

INFO 

Info and.

see logger::info() for more info

PLUGIN 

Plugin level.

see logger::plugin() for more info

WARN 

warn level

see logger::warn() for more info

ERROR 

Error level.

see logger::error() for more info

FATAL 

Fatal level.

see logger::fatal() for more info

OFF 

Off level, just for disabling.

Disbles all possible log levels