libassa  3.5.1
Classes | Namespaces | Macros | Functions
Logger.h File Reference

An abstraction to message logging facility. More...

#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <string>
#include <stack>
#include "assa/Logger_Impl.h"
#include "assa/Singleton.h"
#include "assa/MemDump.h"

Go to the source code of this file.

Classes

class  ASSA::Logger
 
class  ASSA::DiagnosticContext
 Class DiagnosticContext tracks who deep a function is in the calling stack. More...
 

Namespaces

 ASSA
 
 ASSA::Log
 

Macros

#define LOGGER   ASSA::Logger::get_instance()
 A shortcut to locate a singleton object of class Logger. More...
 
#define DL(X)
 A macro for writing debug message to the Logger. More...
 
#define EL(X)
 A macro for writing error message to the Logger. More...
 
#define trace(s)   ASSA::DiagnosticContext tRaCeR(s);
 trace() is used to trace function call chain in C++ program. More...
 
#define trace_with_mask(s, m)   ASSA::DiagnosticContext tRaCeR(s, m);
 trace_with_mask() is used to trace function call chain in C++ program. More...
 

Functions

void ASSA::Log::set_app_name (const std::string &appname_)
 Set application name. More...
 
int ASSA::Log::open_log_file (const char *logfname_, u_long groups_=ALL, u_long maxsize_=10485760)
 Open log file. More...
 
int ASSA::Log::open_log_stdout (u_long groups_=ALL)
 Write log message to standard output. More...
 
int ASSA::Log::open_log_server (const std::string &logsvraddr_, const char *logfname_, Reactor *reactor_, u_long groups_=ASSA::ALL, u_long maxsize_=10485760)
 Open connection with and write log message to the log server. More...
 
void ASSA::Log::log_resync (void)
 Resynchronize logging stream after Fork. More...
 
int ASSA::Log::log_close (void)
 Close logging stream. More...
 
void ASSA::Log::set_gmt_timezone (void)
 Set timezone to GMT. More...
 
void ASSA::Log::enable_timestamp (void)
 Enable timestamp logging. More...
 
void ASSA::Log::disable_timestamp (void)
 Disable timestamp logging. More...
 

Detailed Description

An abstraction to message logging facility.

Definition in file Logger.h.

Macro Definition Documentation

◆ DL

#define DL (   X)
Value:
do { \
LOGGER->log_msg X; \
} while (0)

A macro for writing debug message to the Logger.

Definition at line 273 of file Logger.h.

◆ EL

#define EL (   X)
Value:
do { \
LOGGER->log_msg X; \
LOGGER->log_msg(ASSA::ASSAERR,"errno: %d \"%s\"\n", errno, strerror(errno)); \
} while (0)
@ ASSAERR
ASSA and system errors
Definition: LogMask.h:34

A macro for writing error message to the Logger.

Definition at line 285 of file Logger.h.

◆ LOGGER

#define LOGGER   ASSA::Logger::get_instance()

A shortcut to locate a singleton object of class Logger.

Definition at line 136 of file Logger.h.

◆ trace

#define trace (   s)    ASSA::DiagnosticContext tRaCeR(s);

trace() is used to trace function call chain in C++ program.

trace() logs a message of type [function_name] –v– with log level TRACE, where 'function_name' is the argument supplied. Upon exiting from the function, record [function_name] –^– is written to the log file.

Application user can easily turn trace on/off by supplying different debug mask with {'-m', '–mask'} command-line argument and masking out highest bit in debug mask: TRACE

Definition at line 429 of file Logger.h.

◆ trace_with_mask

#define trace_with_mask (   s,
 
)    ASSA::DiagnosticContext tRaCeR(s, m);

trace_with_mask() is used to trace function call chain in C++ program.

Mask is used to limit the scope of the messages.

Definition at line 437 of file Logger.h.