# Logging API

This file defines macros that provide message logging functionality. More...

## Defines

#define | LOG_LEVEL_INFO 0
| Specifies the log level for Information messages.
#define | LOG_LEVEL_ERROR 1
| Specifies the log level for Error messages.
#define | LOG_LEVEL_WARN 2
| Specifies the log level for Warning messages.
#define | LOG_LEVEL_DEBUG 3
| Specifies the log level for Debug messages.
#define | DEFAULT_LOG_LEVEL LOG_LEVEL_INFO
| Specifies the default log level.
#define | PRINT_MSG(level, str)
| Prints log messages.
#define | INFO_MSG(str) PRINT_MSG(LOG_LEVEL_INFO, str)
| Prints a log message of level `LOG_LEVEL_INFO`.
#define | COMP_INFO_MSG(str) ERROR_MSG("<" << comp_name << "> " << str)
| Prints a component-specific log message of level `LOG_LEVEL_INFO`.
#define | CAT_INFO_MSG(str) ERROR_MSG("<" CAT_NAME "> " << str)
| Prints a category-specific (Component type) system error log message of level `LOG_LEVEL_INFO`.
#define | ERROR_MSG(str) PRINT_MSG(LOG_LEVEL_ERROR, str)
| Prints a log message of level `LOG_LEVEL_ERROR`.
#define | COMP_ERROR_MSG(str) ERROR_MSG("<" << comp_name << "> " << str)
| Prints a component-specific log message of level `LOG_LEVEL_ERROR`.
#define | CAT_ERROR_MSG(str) ERROR_MSG("<" CAT_NAME "> " << str)
| Prints a category-specific (Component type) log message of level `LOG_LEVEL_ERROR`.
#define | SYS_ERROR_MSG(str) ERROR_MSG(str << ": " << strerror(errno))
| Prints a system error log message of level `LOG_LEVEL_ERROR` with the string description of the errno value appended.
#define | COMP_SYS_ERROR_MSG(str) SYS_ERROR_MSG("<" << comp_name << "> " << str)
| Prints a component-specific system error log message of level `LOG_LEVEL_ERROR`.
#define | CAT_SYS_ERROR_MSG(str) SYS_ERROR_MSG("<" CAT_NAME "> " << str)
| Prints a category-specific (Component type) system error log message of level `LOG_LEVEL_ERROR`.
#define | WARN_MSG(str) PRINT_MSG(LOG_LEVEL_WARN, str)
| Prints a log message of level `LOG_LEVEL_WARN`.
#define | COMP_WARN_MSG(str) WARN_MSG("<" << comp_name << "> :" << str)
| Prints a component-specific log message of level `LOG_LEVEL_WARN`.
#define | CAT_WARN_MSG(str) WARN_MSG("<" CAT_NAME "> " << str)
| Print a category-specific (Component type) log message of level `LOG_LEVEL_WARN`.
#define | DEBUG_MSG(str) PRINT_MSG(LOG_LEVEL_DEBUG, str)
| Prints a log message of level `LOG_LEVEL_DEBUG`.
#define | COMP_DEBUG_MSG(str) DEBUG_MSG("<" << comp_name << "> :" << str)
| Prints a component-specific log message of level `LOG_LEVEL_DEBUG`.
#define | CAT_DEBUG_MSG(str) DEBUG_MSG("<" CAT_NAME "> " << str)
| Prints a category-specific (Component type) log message of level `LOG_LEVEL_DEBUG`.

## Variables

int | log_level
| Holds the current log level at runtime by assignment of one of the `LOG_LEVEL_*` values.

## Detailed Description

This file defines macros that provide message logging functionality.

## Define Documentation

#define CAT_DEBUG_MSG | ( | str |  | ) | DEBUG_MSG("<" CAT_NAME "> " << str)

Prints a category-specific (Component type) log message of level `LOG_LEVEL_DEBUG`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <cat_name> <message_content>

Definition at line 221 of file NvLogging.h.

#define CAT_ERROR_MSG | ( | str |  | ) | ERROR_MSG("<" CAT_NAME "> " << str)

Prints a category-specific (Component type) log message of level `LOG_LEVEL_ERROR`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <cat_name> <message_content>

Definition at line 150 of file NvLogging.h.

#define CAT_INFO_MSG | ( | str |  | ) | ERROR_MSG("<" CAT_NAME "> " << str)

Prints a category-specific (Component type) system error log message of level `LOG_LEVEL_INFO`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE: LINE_NUM) <cat_name> <message_content>

Definition at line 127 of file NvLogging.h.

#define CAT_SYS_ERROR_MSG | ( | str |  | ) | SYS_ERROR_MSG("<" CAT_NAME "> " << str)

Prints a category-specific (Component type) system error log message of level `LOG_LEVEL_ERROR`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <cat_name> <message_content>

Definition at line 174 of file NvLogging.h.

#define CAT_WARN_MSG | ( | str |  | ) | WARN_MSG("<" CAT_NAME "> " << str)

Print a category-specific (Component type) log message of level `LOG_LEVEL_WARN`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <cat_name> <message_content>

Definition at line 198 of file NvLogging.h.

#define COMP_DEBUG_MSG | ( | str |  | ) | DEBUG_MSG("<" << comp_name << "> :" << str)

Prints a component-specific log message of level `LOG_LEVEL_DEBUG`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <comp_name> <message_content>

Definition at line 212 of file NvLogging.h.

#define COMP_ERROR_MSG | ( | str |  | ) | ERROR_MSG("<" << comp_name << "> " << str)

Prints a component-specific log message of level `LOG_LEVEL_ERROR`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <comp_name> <message_content>

Definition at line 141 of file NvLogging.h.

#define COMP_INFO_MSG | ( | str |  | ) | ERROR_MSG("<" << comp_name << "> " << str)

Prints a component-specific log message of level `LOG_LEVEL_INFO`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE: LINE_NUM) <comp_name> <message_content>

Definition at line 118 of file NvLogging.h.

#define COMP_SYS_ERROR_MSG | ( | str |  | ) | SYS_ERROR_MSG("<" << comp_name << "> " << str)

Prints a component-specific system error log message of level `LOG_LEVEL_ERROR`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <comp_name> <message_content>

Definition at line 165 of file NvLogging.h.

#define COMP_WARN_MSG | ( | str |  | ) | WARN_MSG("<" << comp_name << "> :" << str)

Prints a component-specific log message of level `LOG_LEVEL_WARN`.

This is used by the components internally and should not be used by the application.

Messages are in the following form: [LEVEL] (FILE:LINE_NUM) <comp_name> <message_content>

Definition at line 188 of file NvLogging.h.

#define DEBUG_MSG | ( | str |  | ) | PRINT_MSG(LOG_LEVEL_DEBUG, str)

Prints a log message of level `LOG_LEVEL_DEBUG`.

Definition at line 203 of file NvLogging.h.

#define DEFAULT_LOG_LEVEL LOG_LEVEL_INFO

Specifies the default log level.

Definition at line 78 of file NvLogging.h.

#define ERROR_MSG | ( | str |  | ) | PRINT_MSG(LOG_LEVEL_ERROR, str)

Prints a log message of level `LOG_LEVEL_ERROR`.

Definition at line 132 of file NvLogging.h.

#define INFO_MSG | ( | str |  | ) | PRINT_MSG(LOG_LEVEL_INFO, str)

Prints a log message of level `LOG_LEVEL_INFO`.

Definition at line 109 of file NvLogging.h.

#define LOG_LEVEL_DEBUG 3

Specifies the log level for Debug messages.

Definition at line 67 of file NvLogging.h.

#define LOG_LEVEL_ERROR 1

Specifies the log level for Error messages.

Definition at line 59 of file NvLogging.h.

#define LOG_LEVEL_INFO 0

Specifies the log level for Information messages.

Definition at line 55 of file NvLogging.h.

#define LOG_LEVEL_WARN 2

Specifies the log level for Warning messages.

Definition at line 63 of file NvLogging.h.

#define PRINT_MSG | ( | level,
|  | str |  | ) |

Value:

    if(level <= log_level) { std::cerr << "[" #level "] (" __FILE__ ":" \
                                  __LINE_NUM_STR__ ") " << str << std::endl; }

Prints log messages.

Prints a log message only if the current `log_level` is greater than or equal to the level of the message.

Messages are in the following form: [LEVEL] (FILE: LINE_NUM) Message

Parameters:

  `[in]` | level | The Log level of the message.
  `[in]` | str | The NULL-terminated char array to print.

Definition at line 103 of file NvLogging.h.

#define SYS_ERROR_MSG | ( | str |  | ) | ERROR_MSG(str << ": " << strerror(errno))

Prints a system error log message of level `LOG_LEVEL_ERROR` with the string description of the errno value appended.

Definition at line 156 of file NvLogging.h.

#define WARN_MSG | ( | str |  | ) | PRINT_MSG(LOG_LEVEL_WARN, str)

Prints a log message of level `LOG_LEVEL_WARN`.

Definition at line 179 of file NvLogging.h.

## Variable Documentation

int log_level

Holds the current log level at runtime by assignment of one of the `LOG_LEVEL_*` values.

Definition at line 31 of file NvLogging.cpp.