log.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <stdarg.h>
#include <unistd.h>
#include <curl/curl.h>
#include "testrunnerlite.h"
#include "log.h"

Go to the source code of this file.

Functions

LOCAL char * create_msg (const char *fmt,...)
LOCAL char * vcreate_msg (const char *fmt, va_list ap)
void log_msg (int type, const char *file, const char *function, int lineno, char *format,...)
void log_init (testrunner_lite_options *opts)
void log_close ()

Variables

struct timeval created
LOCAL CURL * curl
LOCAL int do_syslog = 0
const char * stream_names []
LOCAL int verbosity_level = 0


Function Documentation

LOCAL char * create_msg ( const char *  fmt,
  ... 
)

Allocate buffer and print to message to it

Parameters:
fmt format as in printf
Returns:
buffer with message or NULL in case of too big message

Definition at line 97 of file log.c.

void log_close ( void   ) 

Closes the log, flush stdout and cleanup curl if it's in use

Definition at line 377 of file log.c.

void log_init ( testrunner_lite_options opts  ) 

Sets the verbosity level

Parameters:
opts testrunner lite options

Definition at line 344 of file log.c.

void log_msg ( int  type,
const char *  file,
const char *  function,
int  lineno,
char *  format,
  ... 
)

Prints a log message to stdout in format "[LOG_TYPE] HH:MM:SS message" Usage is the same as in regular printf(), except the first parameter Example: log_msg (LOG_ERR, "Error message %s\n", "Failure");

Parameters:
type Log type defined in log_message_types enum
file Source file name the log entry corresponds to
function Function emitting the log
lineno Line number
format Message format

Definition at line 192 of file log.c.

LOCAL char * vcreate_msg ( const char *  fmt,
va_list  ap 
)

Allocate buffer and print to message to it

Parameters:
fmt format as in printf
ap argument list
Returns:
buffer with message or NULL in case of too big message

Definition at line 142 of file log.c.


Variable Documentation

struct timeval created

Definition at line 66 of file main.c.

LOCAL CURL* curl

Definition at line 65 of file log.c.

LOCAL int do_syslog = 0

Definition at line 66 of file log.c.

const char* stream_names[]

Initial value:

 {"EMERG", "ALERT", "CRITICAL", "ERROR",
                              "WARNING", "NOTICE", "INFO", "DEBUG", "UNKNOWN" }

Definition at line 72 of file log.c.

LOCAL int verbosity_level = 0

Definition at line 77 of file log.c.


Generated on Wed Nov 10 14:13:01 2010 for testrunner-lite by  doxygen 1.5.6