Loading...
Searching...
No Matches
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

namespace | ASSA
namespace | ASSA::Log

## Macros

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

## Functions

void | ASSA::Log::set_app_name (const std::string &appname_)
| Set application name.
int | ASSA::Log::open_log_file (const char *logfname_, u_long groups_=ALL, u_long maxsize_=10485760)
| Open log file.
int | ASSA::Log::open_log_stdout (u_long groups_=ALL)
| Write log message to standard output.
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.
void | ASSA::Log::log_resync (void)
| Resynchronize logging stream after Fork.
int | ASSA::Log::log_close (void)
| Close logging stream.
void | ASSA::Log::set_gmt_timezone (void)
| Set timezone to GMT.
void | ASSA::Log::enable_timestamp (void)
| Enable timestamp logging.
void | ASSA::Log::disable_timestamp (void)
| Disable timestamp logging.

## 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)
LOGGER
#define LOGGER
A shortcut to locate a singleton object of class Logger.
Definition Logger.h:136

A macro for writing debug message to the Logger.

Definition at line 273 of file Logger.h.

{ \
LOGGER->log_msg X; \
} while (0)

## EL

#define EL | ( |  | X | ) |

Value:
do { \
LOGGER->log_msg X; \
LOGGER->log_msg(ASSA::ASSAERR,"errno: %d \"%s\"\n", errno, strerror(errno)); \
} while (0)
ASSA::ASSAERR
@ 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->log_msg X; \
LOGGER->log_msg(ASSA::ASSAERR,"errno: %d \"%s\"\n", errno, strerror(errno)); \
} while (0)

## 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,
|  |  | m
| ) |  | 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.