Colored log module

This module implements a logging module with colored output. More...

Detailed Description

This module implements a logging module with colored output.

Files

file  log_module.h
 log_module header
 

Macros

#define LOG_ERROR_ANSI_COLOR_CODE   ("\033[1;31m")
 Default ANSI color escape code for error logs. More...
 
#define LOG_WARNING_ANSI_COLOR_CODE   ("\033[1;33m")
 Default ANSI color escape code for warning logs. More...
 
#define LOG_INFO_ANSI_COLOR_CODE   ("\033[1m")
 Default ANSI color escape code for info logs. More...
 
#define LOG_DEBUG_ANSI_COLOR_CODE   ("\033[0;32m")
 Default ANSI color escape code for debug logs. More...
 
#define LOG_RESET_ANSI_COLOR_CODE   ("\033[0m")
 ANSI color escape code used for resetting color.
 

Functions

static void log_write (unsigned level, const char *format,...)
 log_write overridden function for colored output More...
 

Variables

static const char *const _ansi_codes []
 ANSI color escape codes array. More...
 

Macro Definition Documentation

◆ LOG_DEBUG_ANSI_COLOR_CODE

#define LOG_DEBUG_ANSI_COLOR_CODE   ("\033[0;32m")

Default ANSI color escape code for debug logs.

Default is green

Definition at line 67 of file log_module.h.

◆ LOG_ERROR_ANSI_COLOR_CODE

#define LOG_ERROR_ANSI_COLOR_CODE   ("\033[1;31m")

Default ANSI color escape code for error logs.

Default is bold red

Definition at line 40 of file log_module.h.

◆ LOG_INFO_ANSI_COLOR_CODE

#define LOG_INFO_ANSI_COLOR_CODE   ("\033[1m")

Default ANSI color escape code for info logs.

Default is bold white

Definition at line 58 of file log_module.h.

◆ LOG_WARNING_ANSI_COLOR_CODE

#define LOG_WARNING_ANSI_COLOR_CODE   ("\033[1;33m")

Default ANSI color escape code for warning logs.

Default is bold yellow

Definition at line 49 of file log_module.h.

Function Documentation

◆ log_write()

static void log_write ( unsigned  level,
const char *  format,
  ... 
)
inlinestatic

log_write overridden function for colored output

Parameters
[in]levelLogging level
[in]formatString format to print

Definition at line 94 of file log_module.h.

Variable Documentation

◆ _ansi_codes

const char* const _ansi_codes[]
static
Initial value:
=
{
}
Informational log level, will print purely informational messages like successful system bootup...
Definition: log.h:58
#define LOG_DEBUG_ANSI_COLOR_CODE
Default ANSI color escape code for debug logs.
Definition: log_module.h:67
Error log level, will print only critical, non-recoverable errors like hardware initialization failur...
Definition: log.h:53
Warning log level, will print warning messages for temporary errors.
Definition: log.h:56
#define LOG_ERROR_ANSI_COLOR_CODE
Default ANSI color escape code for error logs.
Definition: log_module.h:40
#define LOG_WARNING_ANSI_COLOR_CODE
Default ANSI color escape code for warning logs.
Definition: log_module.h:49
#define LOG_INFO_ANSI_COLOR_CODE
Default ANSI color escape code for info logs.
Definition: log_module.h:58
Debug log level, printing developer stuff considered too verbose for production use.
Definition: log.h:61

ANSI color escape codes array.

Internal use only

Definition at line 80 of file log_module.h.