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.

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

void log_close ()
 Close the log file or syslog.

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.7 2002/12/21 13:56:04 hauk 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 173 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 ASSERT, myrun::dolog, myrun::have_tty, Run, and myrun::use_syslog.

Referenced by can_http(), check_file(), check_ftp(), check_http(), check_imap(), check_nntp(), check_pop(), check_smtp(), check_ssh(), create_pidfile(), daemonize(), error(), find_rcfile(), get_pid(), get_timestamp(), monit_http(), out_print(), spawn(), and validate().

void log_close  
 

Close the log file or syslog.

Definition at line 149 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.