libcfe  0.12.1
some useful C-functions
logfile.c File Reference
#include "config.h"
#include "logfile.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <syslog.h>
#include <libintl.h>
#include "output.h"
#include "len.h"
Include dependency graph for logfile.c:

Go to the source code of this file.

Macros

#define TMP_LOGFILE_TEMPLATE   "logfile.XXXXXX"
 
#define TMPDIR   "/tmp"
 

Functions

FILE * mk_temp_logfile (void)
 
void remove_temp_logfile (FILE **tmplogfp)
 
FILE * mk_logfile (FILE *tmplogfp, const char *file)
 
void close_logfile (FILE **fd)
 

Macro Definition Documentation

◆ TMP_LOGFILE_TEMPLATE

#define TMP_LOGFILE_TEMPLATE   "logfile.XXXXXX"

Definition at line 15 of file logfile.c.

◆ TMPDIR

#define TMPDIR   "/tmp"

Definition at line 21 of file logfile.c.

Function Documentation

◆ close_logfile()

void close_logfile ( FILE **  fd)

Close an opened log file and reset the file descriptor.

Parameters
[in,out]fdPointer to a file descriptor pointer, this will be NULL afterwards.

Definition at line 139 of file logfile.c.

◆ mk_logfile()

FILE* mk_logfile ( FILE *  tmplogfp,
const char *  file 
)

create a new log file and moves the content from the temporary log file in it, afterwards it deletes the temporary log file.

Parameters
[in]tmplogfpFile pointer return by mk_temp_logfile.
[in]filePointer to a string representing the filename for the new log file.
Returns
A file descriptor to the opened log file.

Definition at line 72 of file logfile.c.

◆ mk_temp_logfile()

FILE* mk_temp_logfile ( void  )

Make a temporary log file for early logging. This log file will be copied in an persistent log file by mk_logfile.

Returns
A file descriptor to an opened temporary log file.

Definition at line 26 of file logfile.c.

◆ remove_temp_logfile()

void remove_temp_logfile ( FILE **  tmplogfp)

Remove the temporary log file. If you want to turn the temporary log file in a permanent one see mk_logfile.

Parameters
[in,out]tmplogfpPointer to a file descriptor pointer, this is a reference to the return value of mk_temp_logfile. This will be NULL afterwards.

Definition at line 56 of file logfile.c.