SphinxBase 0.6
err.c File Reference

Somewhat antiquated logging and error interface. More...

#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include "sphinxbase/err.h"

Go to the source code of this file.

Functions

int err_set_debug_level (int level)
 Set debugging verbosity level.
 
int err_get_debug_level (void)
 Get debugging verbosity level.
 
FILE * err_get_logfp (void)
 Get the current logging filehandle.
 
FILE * err_set_logfp (FILE *newfp)
 Direct all logging to a given filehandle.
 
int err_set_logfile (char const *file)
 Append all log messages to a given file.
 
void _E__pr_info_header_wofn (char const *msg)
 
void _E__pr_header (char const *f, long ln, char const *msg)
 
void _E__pr_info_header (char const *f, long ln, char const *msg)
 
void _E__pr_warn (char const *fmt,...)
 
void _E__pr_info (char const *fmt,...)
 
void _E__die_error (char const *fmt,...)
 
void _E__fatal_sys_error (char const *fmt,...)
 
void _E__sys_error (char const *fmt,...)
 
void _E__abort_error (char const *fmt,...)
 

Variables

FILE * logfp = NULL
 

Detailed Description

Somewhat antiquated logging and error interface.

Definition in file err.c.

Function Documentation

◆ _E__abort_error()

void _E__abort_error ( char const *  fmt,
  ... 
)

Definition at line 349 of file err.c.

◆ _E__die_error()

void _E__die_error ( char const *  fmt,
  ... 
)

Definition at line 283 of file err.c.

◆ _E__fatal_sys_error()

void _E__fatal_sys_error ( char const *  fmt,
  ... 
)

Definition at line 304 of file err.c.

◆ _E__pr_header()

void _E__pr_header ( char const *  f,
long  ln,
char const *  msg 
)

Definition at line 218 of file err.c.

◆ _E__pr_info()

void _E__pr_info ( char const *  fmt,
  ... 
)

Definition at line 267 of file err.c.

◆ _E__pr_info_header()

void _E__pr_info_header ( char const *  f,
long  ln,
char const *  msg 
)

Definition at line 234 of file err.c.

◆ _E__pr_info_header_wofn()

void _E__pr_info_header_wofn ( char const *  msg)

Definition at line 205 of file err.c.

◆ _E__pr_warn()

void _E__pr_warn ( char const *  fmt,
  ... 
)

Definition at line 251 of file err.c.

◆ _E__sys_error()

void _E__sys_error ( char const *  fmt,
  ... 
)

Definition at line 330 of file err.c.

◆ err_get_debug_level()

int err_get_debug_level ( void  )

Get debugging verbosity level.

Note that debugging messages are only enabled when compiled with -DDEBUG.

Definition at line 74 of file err.c.

◆ err_get_logfp()

FILE * err_get_logfp ( void  )

Get the current logging filehandle.

Returns
Current logging filehandle, NULL if disabled.

Definition at line 157 of file err.c.

Referenced by cmd_ln_parse_r(), err_set_logfile(), and err_set_logfp().

◆ err_set_debug_level()

int err_set_debug_level ( int  level)

Set debugging verbosity level.

Note that debugging messages are only enabled when compiled with -DDEBUG.

Parameters
levelVerbosity level to set, or 0 to disable debug messages.

Definition at line 68 of file err.c.

◆ err_set_logfile()

int err_set_logfile ( char const *  file)

Append all log messages to a given file.

Previous logging filehandle is closed (unless it was stdout or stderr).

Parameters
fileFile to send log messages to, or NULL to disable logging.
Returns
0 for success, <0 for failure (e.g. if file does not exist)

Definition at line 190 of file err.c.

References err_get_logfp().

Referenced by cmd_ln_parse_r().

◆ err_set_logfp()

FILE * err_set_logfp ( FILE *  logfp)

Direct all logging to a given filehandle.

Parameters
logfpFilehandle to send log messages to, or NULL to disable logging.
Returns
Previous logging filehandle, if any.

Definition at line 179 of file err.c.

References err_get_logfp().

Variable Documentation

◆ logfp

FILE* logfp = NULL

Definition at line 154 of file err.c.