ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Functions | Variables
log.c File Reference

Logging library. More...

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

Functions

void vlogger (enum log_level level, char *file, unsigned line, const char *fmt,...)
 Logs a message. Don't use this function directly, rely on the logger() macro instead. More...
 
void log_init (FILE *file)
 Initialize the logging subsystem. More...
 

Variables

static FILE * logfile = NULL
 The file to write logging information to.
 
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.

Function Documentation

◆ log_init()

void log_init ( FILE *  file)

Initialize the logging subsystem.

Parameters
fileThe FILE to write logging information to. If set to NULL, it is defaulted to stdout.

◆ vlogger()

void vlogger ( enum log_level  level,
char *  file,
unsigned  line,
const char *  fmt,
  ... 
)

Logs a message. Don't use this function directly, rely on the logger() macro instead.

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

Variable Documentation

◆ 

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"}
}
@ LOG_ERROR
The logging level reserved to unexpected, problematic conditions.
Definition: ROOT-Sim.h:112
@ LOG_TRACE
The logging level reserved to very low priority messages.
Definition: ROOT-Sim.h:108
@ LOG_INFO
The logging level reserved to useful runtime messages.
Definition: ROOT-Sim.h:110
@ LOG_DEBUG
The logging level reserved to useful debug messages.
Definition: ROOT-Sim.h:109
@ LOG_FATAL
The logging level reserved to unexpected, fatal conditions.
Definition: ROOT-Sim.h:113
@ LOG_WARN
The logging level reserved to unexpected, non deal breaking conditions.
Definition: ROOT-Sim.h:111

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