SCTC
the soundcloud.com terminal client
Functions | Variables
log.c File Reference
#include "log.h"
Include dependency graph for log.c:

Functions

bool log_init (char *file)
 
void __log (char *srcfile, int srcline, const char *srcfunc, char *fmt,...)
 
void log_close ()
 

Variables

static FILE * log_fh = NULL
 
static sem_t log_sem
 

Function Documentation

void __log ( char *  srcfile,
int  srcline,
const char *  srcfunc,
char *  fmt,
  ... 
)

The internal implementation for logging.

Warning
This function is not intended to be called directly by the user. Use _log() instead, as this macro inserts the correct position of the call to __log().

This function is synchronized internally and therefore may be called by several threads 'at once'.

Parameters
srcfileThe file executing the call to __log(); filled by macro _log(), do not use "by hand"
srclineThe line in the file executing the call to __log(); filled by macro _log(), do not use "by hand"
srcfuncThe function callint __log(); filled by macro _log(), do not use "by hand"
fmtThe format used format the line, see man 3 printf for usage.

Here is the caller graph for this function:

void log_close ( )

Finalize logging.

Closes any opened descriptors and frees any remaining memory allocated during usage. Any calls to _log() after call to log_close() do not have any effect.

Typically this function is only called prior to termination.

Here is the caller graph for this function:

bool log_init ( char *  file)

Initialize logging.

Initialize logging and thus allow subsequent calls to _log().

Typically this function is called only once directly after starting up the execution

Parameters
fileThe file to log to, either relative or absolute path.
Returns
true on success, false on error

Here is the caller graph for this function:

Variable Documentation

FILE* log_fh = NULL
static
sem_t log_sem
static