libgeda

s_log.c File Reference

#include <config.h>
#include <stdio.h>
#include <sys/stat.h>
#include "libgeda_priv.h"
#include <time.h>
Include dependency graph for s_log.c:

Go to the source code of this file.

Defines

#define CATCH_LOG_LEVELS
#define PRINT_LOG_LEVELS
#define LOG_OPEN_ATTEMPTS   5
#define BUFSIZE   200

Functions

static void s_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
 Write a message to the current log file.
void s_log_init (const gchar *prefix)
 Initialize libgeda logging feature.
void s_log_close (void)
 Terminates the logging of messages.
gchar * s_log_read (void)
 Reads the current log file and returns its contents.

Variables

void(* x_log_update_func )() = NULL
int do_logging = TRUE
static int logfile_fd = -1
static guint log_handler_id

Define Documentation

#define CATCH_LOG_LEVELS
Value:
(G_LOG_LEVEL_MASK ^ \
                          (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO))

Definition at line 54 of file s_log.c.

#define PRINT_LOG_LEVELS
Value:
(CATCH_LOG_LEVELS ^ \
                          (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE))

Definition at line 56 of file s_log.c.

#define LOG_OPEN_ATTEMPTS   5

Definition at line 59 of file s_log.c.

#define BUFSIZE   200

Function Documentation

static void s_log_handler ( const gchar *  log_domain,
GLogLevelFlags  log_level,
const gchar *  message,
gpointer  user_data 
) [static]
Function Description
Writes message to the current log file whose file descriptor is logfile_fd.

It also sends message to the optional function x_log_update for further use.

Parameters:
[in]log_domain(unused).
[in]log_level(unused).
[in]messageCharacter string containing message to write to log.
[in]user_data(unused).

Definition at line 251 of file s_log.c.

void s_log_init ( const gchar *  prefix)
Function Description
This function opens the file filename to log to and registers the handler to redirect log message to this file.
Parameters:
[in]prefixCharacter string with file name prefix to log to.

Definition at line 77 of file s_log.c.

Here is the call graph for this function:

void s_log_close ( void  )
Function Description
This function deregisters the handler for redirection to the log file and closes it.

Definition at line 180 of file s_log.c.

gchar* s_log_read ( void  )
Function Description
This function reads the current log file and returns its contents.
Returns:
Character string with current log's contents.

Definition at line 207 of file s_log.c.


Variable Documentation

void(* x_log_update_func)() = NULL

Default setting for log update callback function.

Definition at line 49 of file s_log.c.

int do_logging = TRUE

Default setting for log enable.

Definition at line 52 of file s_log.c.

int logfile_fd = -1 [static]

Definition at line 66 of file s_log.c.

guint log_handler_id [static]

Definition at line 68 of file s_log.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines