log.c File Reference

Implementation of a logger that appends log messages to a file with a preceding timestamp. More...

Go to the source code of this file.

Functions

int log_init ()
 Initialize the log system and 'log' function. More...

void log (const char *format,...)
 Log a message to monits logfile or syslog. More...

void log_close ()
 Close the log file or syslog. More...

int get_log_fd ()


Detailed Description

Implementation of a logger that appends log messages to a file with a preceding timestamp.

Methods support both syslog or own logfile.

Author:
Jan-Henrik Haukeland, <hauk@tildeslash.com>
Version:
$Id: log.c,v 1.4 2002/08/26 16:28:39 chopp Exp $

Definition in file log.c.


Function Documentation

int get_log_fd  
 

Returns:
the log filedescriptor or -1 if it's not open, i.e. syslog is used or logging is not activated

Definition at line 172 of file log.c.

void log const char *    format,
...   
 

Log a message to monits logfile or syslog.

Parameters:
format  A formated (printf-style) string to log

Definition at line 111 of file log.c.

References myrun::debug, myrun::dolog, have_tty, Run, and myrun::use_syslog.

Referenced by check_ftp(), check_http(), check_imap(), check_nntp(), check_pop(), check_smtp(), compare_resource(), daemonize(), error(), get_pid(), monit_http(), out_print(), spawn(), start_process(), stop_process(), and validate().

void log_close  
 

Close the log file or syslog.

Definition at line 148 of file log.c.

References error(), prog, Run, STRERROR, and myrun::use_syslog.

Referenced by log_init().

int log_init  
 

Initialize the log system and 'log' function.

Returns:
TRUE if the log system was successfully initialized

Definition at line 84 of file log.c.

References myrun::dolog, log_close(), and Run.