yumapro  20.10-10
YumaPro SDK
Logging Functions

Configure logging and write to the various logging streams. More...

Collaboration diagram for Logging Functions:

Functions

void log_cleanup (boolean phase2, boolean debugs)
 Final logger cleanup prior to restart or shutdown. More...
 
status_t log_open (const char *fname, boolean append, boolean tstamps)
 Open a logfile for writing. More...
 
void log_close (void)
 Close the logfile. More...
 
status_t log_audit_open (const char *fname, boolean append, boolean tstamps)
 Open the audit logfile for writing. More...
 
void log_audit_close (void)
 Close the audit_logfile. More...
 
boolean log_audit_is_open (void)
 Check if the audit log is open. More...
 
status_t log_alt_open (const char *fname)
 Open an alternate logfile for writing. More...
 
status_t log_alt_open_ex (const char *fname, boolean overwrite)
 Open an alternate logfile for writing. More...
 
void log_alt_close (void)
 Close the alternate logfile. More...
 
void log_init (void)
 Initialize logger state. More...
 
void log_flush (void)
 Flush output buffers. More...
 
void log_stdout (const char *fstr,...) __attribute__((format(printf
 Write output to STDOUT. More...
 
void void log_stdout_level (log_debug_t level, const char *fstr,...) __attribute__((format(printf
 Write output to STDOUT if debug level set. More...
 
void void void log_write (const char *fstr,...) __attribute__((format(printf
 Write a new entry to the main log. More...
 
void void void void log_write_append (const char *fstr,...) __attribute__((format(printf
 Append to the last log entry to the main log. More...
 
void void void void void void void void void log_audit_write (const char *fstr,...) __attribute__((format(printf
 Write an new entry to the audit log file. More...
 
void void void void void void void void void void log_audit_write_level (log_debug_t level, const char *fstr,...) __attribute__((format(printf
 Write an new entry to the audit log file if the log level is set. More...
 
void log_alt_write (const char *fstr,...) __attribute__((format(printf
 Write to the alternate log file. More...
 
void void log_alt_write_level (log_debug_t level, const char *fstr,...) __attribute__((format(printf
 Write to the alternate log file if debug-level set. More...
 
void log_error (const char *fstr,...) __attribute__((format(printf
 Generate a new LOG_DEBUG_ERROR log entry. More...
 
void void log_error_append (const char *fstr,...) __attribute__((format(printf
 Append to a LOG_DEBUG_ERROR log entry. More...
 
void void void log_warn (const char *fstr,...) __attribute__((format(printf
 Generate a new LOG_DEBUG_WARN log entry. More...
 
void void void void log_warn_append (const char *fstr,...) __attribute__((format(printf
 Append to a LOG_DEBUG_WARN log entry. More...
 
void void void void void log_info (const char *fstr,...) __attribute__((format(printf
 Generate a new LOG_DEBUG_INFO log entry. More...
 
void void void void void void log_info_append (const char *fstr,...) __attribute__((format(printf
 Append to a LOG_DEBUG_INFO log entry. More...
 
void void void void void void void log_debug (const char *fstr,...) __attribute__((format(printf
 Generate a new LOG_DEBUG_DEBUG log entry. More...
 
void void void void void void void void log_debug_append (const char *fstr,...) __attribute__((format(printf
 Append to a LOG_DEBUG_DEBUG log entry. More...
 
void void void void void void void void void log_debug2 (const char *fstr,...) __attribute__((format(printf
 Generate a new LOG_DEBUG_DEBUG2 log entry. More...
 
void void void void void void void void void void log_debug2_append (const char *fstr,...) __attribute__((format(printf
 Append to a LOG_DEBUG_DEBUG2 log entry. More...
 
void void void void void void void void void void void log_debug3 (const char *fstr,...) __attribute__((format(printf
 Generate a new LOG_DEBUG_DEBUG3 log entry. More...
 
void void void void void void void void void void void void log_debug3_append (const char *fstr,...) __attribute__((format(printf
 Append to a LOG_DEBUG_DEBUG3 log entry. More...
 
void void void void void void void void void void void void void log_debug4 (const char *fstr,...) __attribute__((format(printf
 Generate a new LOG_DEBUG_DEBUG4 log entry. More...
 
void void void void void void void void void void void void void void log_debug4_append (const char *fstr,...) __attribute__((format(printf
 Append to a LOG_DEBUG_DEBUG4 log entry. More...
 
void void void void void void void void void void void void void void void void void void void void void void void void void void void void void void void void log_set_log_level (log_debug_t dlevel)
 Set the main log level. More...
 
void log_set_syslog_log_level (log_debug_t dlevel)
 Set the syslog log level. More...
 
void log_set_pthread_log_level (log_debug_t dlevel)
 Set the pthreads log level. More...
 
log_debug_t log_get_log_level (void)
 Get the main log level. More...
 
log_debug_t log_get_syslog_log_level (void)
 Get the syslog log level. More...
 
log_debug_t log_get_pthread_log_level (void)
 Get the pthreads log level. More...
 

Detailed Description

Configure logging and write to the various logging streams.

The server can configure 3 different logging streams

The yangcli program uses the 'alt' log to save output to a temporary file.

Function Documentation

void log_alt_close ( void  )

Close the alternate logfile.

See also
log_alt_open

Here is the call graph for this function:

status_t log_alt_open ( const char *  fname)

Open an alternate logfile for writing.

DO NOT use this function to send log entries to STDOUT Leave the logfile NULL instead.

Parameters
fnamefull filespec string for logfile
Returns
status
See also
log_alt_close

Here is the call graph for this function:

status_t log_alt_open_ex ( const char *  fname,
boolean  overwrite 
)

Open an alternate logfile for writing.

DO NOT use this function to send log entries to STDOUT Leave the logfile NULL instead.

Parameters
fnamefull filespec string for logfile
overwriteTRUE if OK to overwrite; FALSE to generate DATA_EXISTS errors
Returns
status
See also
log_alt_close

Here is the caller graph for this function:

void log_alt_write ( const char *  fstr,
  ... 
)

Write to the alternate log file.

Parameters
fstrformat string in printf format
...any additional arguments for fprintf

Here is the caller graph for this function:

void void log_alt_write_level ( log_debug_t  level,
const char *  fstr,
  ... 
)

Write to the alternate log file if debug-level set.

Parameters
leveldebug level to check
fstrformat string in printf format
...any additional arguments for fprintf

Here is the caller graph for this function:

void log_audit_close ( void  )

Close the audit_logfile.

See also
log_audit_open

Here is the call graph for this function:

boolean log_audit_is_open ( void  )

Check if the audit log is open.

Returns
TRUE if audit log is open; FALSE if not

Here is the caller graph for this function:

status_t log_audit_open ( const char *  fname,
boolean  append,
boolean  tstamps 
)

Open the audit logfile for writing.

DO NOT use this function to send log entries to STDOUT Leave the audit_logfile NULL instead.

Parameters
fnamefull filespec string for audit logfile
appendTRUE if the log should be appended; FALSE if it should be rewriten
tstampsTRUE if the datetime stamp should be generated at log-open and log-close time; FALSE if no open and close timestamps should be generated
Returns
status
See also
log_audit_close

Here is the caller graph for this function:

void void void void void void void void void log_audit_write ( const char *  fstr,
  ... 
)

Write an new entry to the audit log file.

Generate an audit log entry, regardless of log level

Parameters
fstrformat string in printf format
...any additional arguments for printf

Here is the caller graph for this function:

void void void void void void void void void void log_audit_write_level ( log_debug_t  level,
const char *  fstr,
  ... 
)

Write an new entry to the audit log file if the log level is set.

Parameters
leveldebug level to check
fstrformat string in printf format
...any additional arguments for printf

Here is the caller graph for this function:

void log_cleanup ( boolean  phase2,
boolean  debugs 
)

Final logger cleanup prior to restart or shutdown.

See also
log_init

Here is the call graph for this function:

Here is the caller graph for this function:

void log_close ( void  )

Close the logfile.

See also
log_open

Here is the call graph for this function:

Here is the caller graph for this function:

void void void void void void void log_debug ( const char *  fstr,
  ... 
)

Generate a new LOG_DEBUG_DEBUG log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug_append
void void void void void void void void void log_debug2 ( const char *  fstr,
  ... 
)

Generate a new LOG_DEBUG_DEBUG2 log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug2_append
void void void void void void void void void void log_debug2_append ( const char *  fstr,
  ... 
)

Append to a LOG_DEBUG_DEBUG2 log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug2

Here is the caller graph for this function:

void void void void void void void void void void void log_debug3 ( const char *  fstr,
  ... 
)

Generate a new LOG_DEBUG_DEBUG3 log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug3_append
void void void void void void void void void void void void log_debug3_append ( const char *  fstr,
  ... 
)

Append to a LOG_DEBUG_DEBUG3 log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug3

Here is the caller graph for this function:

void void void void void void void void void void void void void log_debug4 ( const char *  fstr,
  ... 
)

Generate a new LOG_DEBUG_DEBUG4 log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug4_append
void void void void void void void void void void void void void void log_debug4_append ( const char *  fstr,
  ... 
)

Append to a LOG_DEBUG_DEBUG4 log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug4

Here is the caller graph for this function:

void void void void void void void void log_debug_append ( const char *  fstr,
  ... 
)

Append to a LOG_DEBUG_DEBUG log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_debug

Here is the caller graph for this function:

void log_error ( const char *  fstr,
  ... 
)

Generate a new LOG_DEBUG_ERROR log entry.

In general, call log_error() once and append additional output as many times as necessary to complete the message (for example, from a loop). Note that additional output at a different log level should NOT be attempted, but no check is made for this condition currently.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_error_append
void void log_error_append ( const char *  fstr,
  ... 
)

Append to a LOG_DEBUG_ERROR log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_error

Here is the caller graph for this function:

void log_flush ( void  )

Flush output buffers.

NOTE: For "classic" output this is probably redundant since we clear buffers as we go along. However, for syslog and vendor streams this is important. That's because we buffer our formatted output and only send it on in full chunks. The buffering code can't always know when a buffered log message is complete.

Here is the call graph for this function:

Here is the caller graph for this function:

log_debug_t log_get_log_level ( void  )

Get the main log level.

Returns
the main log level setting

Here is the caller graph for this function:

log_debug_t log_get_pthread_log_level ( void  )

Get the pthreads log level.

Returns
the pthreads log level setting

Here is the call graph for this function:

Here is the caller graph for this function:

log_debug_t log_get_syslog_log_level ( void  )

Get the syslog log level.

Returns
the syslog log level setting

Here is the caller graph for this function:

void void void void void log_info ( const char *  fstr,
  ... 
)

Generate a new LOG_DEBUG_INFO log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_info_append
void void void void void void log_info_append ( const char *  fstr,
  ... 
)

Append to a LOG_DEBUG_INFO log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_info

Here is the caller graph for this function:

void log_init ( void  )

Initialize logger state.

NOTE: Called early in initialization by each app.

See also
log_cleanup
status_t log_open ( const char *  fname,
boolean  append,
boolean  tstamps 
)

Open a logfile for writing.

DO NOT use this function to send log entries to STDOUT Leave the logfile NULL instead.

Parameters
fnamefull filespec string for logfile
appendTRUE if the log should be appended; FALSE if it should be rewriten
tstampsTRUE if the datetime stamp should be generated at log-open and log-close time; FALSE if no open and close timestamps should be generated
Returns
status
See also
log_close

Here is the caller graph for this function:

void void void void void void void void void void void void void void void void void void void void void void void void void void void void void void void void log_set_log_level ( log_debug_t  dlevel)

Set the main log level.

Parameters
dlevelnew main log debug level

Here is the call graph for this function:

Here is the caller graph for this function:

void log_set_pthread_log_level ( log_debug_t  dlevel)

Set the pthreads log level.

Parameters
dlevelnew pthreads log debug level

Here is the call graph for this function:

Here is the caller graph for this function:

void log_set_syslog_log_level ( log_debug_t  dlevel)

Set the syslog log level.

Parameters
dlevelnew syslog log debug level

Here is the call graph for this function:

Here is the caller graph for this function:

void log_stdout ( const char *  fstr,
  ... 
)

Write output to STDOUT.

Write lines of text to STDOUT, even if the logfile is open, unless the debug mode is set to NONE to indicate silent batch mode

Parameters
fstrformat string in printf format @ param ... any additional arguments for printf

Here is the caller graph for this function:

void void log_stdout_level ( log_debug_t  level,
const char *  fstr,
  ... 
)

Write output to STDOUT if debug level set.

Parameters
leveldebug level threshold for printing output
fstrformat string in printf format @ param ... any additional arguments for printf

Here is the caller graph for this function:

void void void log_warn ( const char *  fstr,
  ... 
)

Generate a new LOG_DEBUG_WARN log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_warn_append

Here is the caller graph for this function:

void void void void log_warn_append ( const char *  fstr,
  ... 
)

Append to a LOG_DEBUG_WARN log entry.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_warn

Here is the caller graph for this function:

void void void log_write ( const char *  fstr,
  ... 
)

Write a new entry to the main log.

Generate (append to) a log entry, regardless of log level (except batch mode).

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_write_append

Here is the caller graph for this function:

void void void void log_write_append ( const char *  fstr,
  ... 
)

Append to the last log entry to the main log.

Parameters
fstrformat string in printf format
...any additional arguments for printf
See also
log_write

Here is the caller graph for this function: