CardSight 0.1.0
C API reference for the CardSight firmware and application
Loading...
Searching...
No Matches
log.h File Reference

Kernel log messages: printf-style output at a level, prefixed with the module that prints. More...

#include <stdio.h>

Go to the source code of this file.

Macros

#define LOG_LEVEL_ERROR   1
 Error level: a failure the user should notice.
#define LOG_LEVEL_WARN   2
 Warning level: something unexpected that did not stop the work.
#define LOG_LEVEL_INFO   3
 Informational level: normal progress.
#define LOG_LEVEL_DEBUG   4
 Debug level: developer detail.
#define CONFIG_LOG_LEVEL   LOG_LEVEL_INFO
 Highest level that is printed; defaults to LOG_LEVEL_INFO.
#define LOG_MODULE   "kernel"
 Module name in every message; defaults to "kernel".
#define pr_err(format, ...)
 Log an error message; see log_print().
#define pr_warn(format, ...)
 Log a warning message; see log_print().
#define pr_info(format, ...)
 Log an informational message; see log_print().
#define pr_debug(format, ...)
 Log a debug message; see log_print().

Functions

void log_print (int level, const char *module, const char *format,...) __attribute__((format(printf
 Print one formatted log message to the console.

Detailed Description

Kernel log messages: printf-style output at a level, prefixed with the module that prints.

LOG_MODULE defaults to the file name; a file may define it before including this header.

Function Documentation

◆ log_print()

void log_print ( int level,
const char * module,
const char * format,
... )

Print one formatted log message to the console.

Messages above CONFIG_LOG_LEVEL are dropped. The text is formatted into a fixed-size buffer, prefixed with the time since boot, the level letter, and the module name, then written to the console.

Parameters
[in]levelOne of the LOG_LEVEL_* values.
[in]moduleModule name shown in the prefix.
[in]formatprintf-style format string.
[in]...Arguments for format.