Macros | Functions
LOG: Logging of NNTP communication

Location of protocol logfile: $XDG_CONFIG_HOME/$CFG_NAME/logfile. More...

Macros

#define MAIN_ERR_PREFIX   "LOG: "
 Message prefix for LOG module.
 
#define LOG_PERM   (posix_mode_t) (POSIX_S_IRUSR | POSIX_S_IWUSR)
 Permissions for server protocol logfile.
 

Functions

const char * log_get_logpathname (void)
 Get logfile pathname. More...
 
void log_delete_logfile (void)
 Delete logfile if present.
 
int log_open_logfile (FILE **lfs, const char *logfile)
 Open logfile. More...
 
void log_close_logfile (FILE **lfs)
 Close logfile. More...
 
void log_add (FILE *lfs, const char *data)
 Add data to end of logfile. More...
 
void log_free (void *p)
 Free an object allocated by logging module. More...
 

Detailed Description

Location of protocol logfile: $XDG_CONFIG_HOME/$CFG_NAME/logfile.

Function Documentation

◆ log_add()

void log_add ( FILE *  lfs,
const char *  data 
)

Add data to end of logfile.

Parameters
[in]lfsLogfile stream
[in]dataData string that should be added to logfile

This function never fail, write errors are ignored.

Definition at line 175 of file log.c.

References data.

◆ log_close_logfile()

void log_close_logfile ( FILE **  lfs)

Close logfile.

Parameters
[in]lfsPointer to logfile stream

Definition at line 158 of file log.c.

References fu_close_file().

◆ log_free()

void log_free ( void *  p)

Free an object allocated by logging module.

Use this function to release dynamic memory that was allocated by the logging module.

Parameters
[in]pPointer to object

Release the memory for the object pointed to by p.

Definition at line 200 of file log.c.

◆ log_get_logpathname()

const char* log_get_logpathname ( void  )

Get logfile pathname.

This function must be thread safe. The caller is responsible to free the memory for the buffer on success.

Returns
  • Pointer to logfile pathname on success
  • NULL on error

Definition at line 55 of file log.c.

References fu_create_path(), xdg_append_to_path(), and xdg_get_confdir().

Referenced by log_delete_logfile().

◆ log_open_logfile()

int log_open_logfile ( FILE **  lfs,
const char *  logfile 
)

Open logfile.

Parameters
[out]lfsPointer to logfile stream
[in]logfilePathname of logfile to open

A valid stream pointer was written to lfs before success is returned. Otherwise the location pointed to by lfs is not changed.

Note
If logfile is NULL , the file /dev/null is used instead.
Returns
  • Zero on success
  • -1 on error

Definition at line 114 of file log.c.

References fu_assign_stream(), fu_close_file(), fu_open_file(), LOG_PERM, and PRINT_ERROR.


Generated at 2024-04-27 using  doxygen