libcfe  0.12.1
some useful C-functions
output.h File Reference
#include <stdio.h>
#include <syslog.h>
#include <libintl.h>
Include dependency graph for output.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOG_EMERG_NAME   "PANIC"
 
#define LOG_ALERT_NAME   "ALERT"
 
#define LOG_CRIT_NAME   "CRIT"
 
#define LOG_ERR_NAME   "ERROR"
 
#define LOG_WARNING_NAME   "WARN"
 
#define LOG_NOTICE_NAME   "NOTICE"
 
#define LOG_INFO_NAME   "INFO"
 
#define LOG_DEBUG_NAME   "DEBUG"
 
#define LOG_ERROR   LOG_ERR
 
#define output   output1
 
#define error(...)   output(LOG_ERR, __VA_ARGS__)
 
#define debug(...)   emptyfunc()
 
#define _(string)   gettext(string)
 
#define _OUTPUT_GET_CURRENT_VALUE   127
 Get the current value (See set_output_level, set_output_mode). More...
 
#define _OUTPUT_MODE_PRINT   1
 Print messages to stdout. More...
 
#define _OUTPUT_MODE_SYSLOG   2
 Print messages to syslog. More...
 
#define _OUTPUT_MODE_FILE   4
 Print messages to a logfile (also use set_output_file to set the desired logfile). More...
 

Functions

int set_output_level (int lvl)
 
int set_output_mode (int mode)
 
int set_output_file (FILE *out)
 
void output1 (int lvl, const char *msg,...) __attribute__((format(printf
 

Macro Definition Documentation

◆ _

#define _ (   string)    gettext(string)

Definition at line 43 of file output.h.

◆ _OUTPUT_GET_CURRENT_VALUE

#define _OUTPUT_GET_CURRENT_VALUE   127

Get the current value (See set_output_level, set_output_mode).

Definition at line 46 of file output.h.

◆ _OUTPUT_MODE_FILE

#define _OUTPUT_MODE_FILE   4

Print messages to a logfile (also use set_output_file to set the desired logfile).

Definition at line 50 of file output.h.

◆ _OUTPUT_MODE_PRINT

#define _OUTPUT_MODE_PRINT   1

Print messages to stdout.

Definition at line 48 of file output.h.

◆ _OUTPUT_MODE_SYSLOG

#define _OUTPUT_MODE_SYSLOG   2

Print messages to syslog.

Definition at line 49 of file output.h.

◆ debug

#define debug (   ...)    emptyfunc()

Definition at line 38 of file output.h.

◆ error

#define error (   ...)    output(LOG_ERR, __VA_ARGS__)

See output

Definition at line 30 of file output.h.

◆ LOG_ALERT_NAME

#define LOG_ALERT_NAME   "ALERT"

Definition at line 8 of file output.h.

◆ LOG_CRIT_NAME

#define LOG_CRIT_NAME   "CRIT"

Definition at line 9 of file output.h.

◆ LOG_DEBUG_NAME

#define LOG_DEBUG_NAME   "DEBUG"

Definition at line 14 of file output.h.

◆ LOG_EMERG_NAME

#define LOG_EMERG_NAME   "PANIC"

Definition at line 7 of file output.h.

◆ LOG_ERR_NAME

#define LOG_ERR_NAME   "ERROR"

Definition at line 10 of file output.h.

◆ LOG_ERROR

#define LOG_ERROR   LOG_ERR

Definition at line 16 of file output.h.

◆ LOG_INFO_NAME

#define LOG_INFO_NAME   "INFO"

Definition at line 13 of file output.h.

◆ LOG_NOTICE_NAME

#define LOG_NOTICE_NAME   "NOTICE"

Definition at line 12 of file output.h.

◆ LOG_WARNING_NAME

#define LOG_WARNING_NAME   "WARN"

Definition at line 11 of file output.h.

◆ output

#define output   output1

See output1

Definition at line 25 of file output.h.

Function Documentation

◆ output1()

void output1 ( int  lvl,
const char *  msg,
  ... 
)

Sent a formatted string to the output function with a level.

Parameters
[in]lvlMessage output level.
[in]msgPointer to the message, this may be a formatted message.
[in]...Additional variable to substitute in message.

◆ set_output_file()

int set_output_file ( FILE *  out)

Set the output file (do not forget to call set_output_mode with at least _OUTPUT_MODE_FILE also).

Parameters
[in]outthe file
Returns
return value
  • 0 succeed
  • 1 failed

Definition at line 45 of file output.c.

◆ set_output_level()

int set_output_level ( int  lvl)

Set the output level, calls to output with a higher value (less important) are ignored.

Parameters
[in]lvlThe desired level.
Returns
The new level.

Definition at line 24 of file output.c.

◆ set_output_mode()

int set_output_mode ( int  mode)

Set the output mode for following output calls, the mode can be one or more of:

Definition at line 33 of file output.c.