The ROme OpTimistic Simulator  3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
log.c File Reference

Logging library. More...

#include <log/log.h>
#include <arch/io.h>
#include <stdarg.h>
#include <stdio.h>
+ Include dependency graph for log.c:

Go to the source code of this file.

Functions

void _log_log (int level, const char *file, unsigned line, const char *fmt,...)
 Logs a message. For internal use: log_log() should be used instead. More...
 
void log_logo_print (void)
 Prints a fancy ROOT-Sim logo on the terminal.
 

Variables

int log_level = LOG_LEVEL
 The minimum log level of the messages to display.
 
bool log_colored
 If set, uses color codes to color the log outputs.
 
struct {
   const char *   name
 
   const char *   color
 
levels []
 The textual representations and the color codes of the logging levels. More...
 

Detailed Description

Logging library.

This library can be used to produce logs during simulation runs.

Definition in file log.c.

Function Documentation

◆ _log_log()

void _log_log ( int  level,
const char *  file,
unsigned  line,
const char *  fmt,
  ... 
)

Logs a message. For internal use: log_log() should be used instead.

Parameters
levelthe importance level of the message to log
filethe file name where this function is being called
linethe line number where this function is being called
fmta printf-style format string for the message to log
...the list of arguments to fill in the format string fmt

Definition at line 44 of file log.c.

Variable Documentation

◆ levels

const { ... } levels[]
Initial value:
= {
[LOG_TRACE] = {.name = "TRACE", .color = "\x1b[94m"},
[LOG_DEBUG] = {.name = "DEBUG", .color = "\x1b[36m"},
[LOG_INFO] = {.name = "INFO", .color = "\x1b[32m"},
[LOG_WARN] = {.name = "WARN", .color = "\x1b[33m"},
[LOG_ERROR] = {.name = "ERROR", .color = "\x1b[31m"},
[LOG_FATAL] = {.name = "FATAL", .color = "\x1b[35m"}
}

The textual representations and the color codes of the logging levels.

LOG_DEBUG
#define LOG_DEBUG
The logging level reserved to useful debug messages.
Definition: log.h:27
LOG_ERROR
#define LOG_ERROR
The logging level reserved to unexpected, problematic conditions.
Definition: log.h:33
LOG_TRACE
#define LOG_TRACE
The logging level reserved to very low priority messages.
Definition: log.h:25
LOG_FATAL
#define LOG_FATAL
The logging level reserved to unexpected, fatal conditions.
Definition: log.h:35
LOG_INFO
#define LOG_INFO
The logging level reserved to useful runtime messages.
Definition: log.h:29
LOG_WARN
#define LOG_WARN
The logging level reserved to unexpected, non deal breaking conditions.
Definition: log.h:31