Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
log.H File Reference

Thread-safe logging utilities. More...

#include <sys/utsname.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <useMutex.H>
Include dependency graph for log.H:

Go to the source code of this file.

Classes

class  Log_Manager
 Thread-safe log manager with timestamps. More...
 

Macros

#define WRITE_IN_LOG(log, format...)   log.write_line(format)
 Macro to write to log with automatic file/line in debug mode.
 

Detailed Description

Thread-safe logging utilities.

This file provides Log_Manager, a thread-safe logging class that writes timestamped messages to a file with mutex protection.

Features

  • Thread-safe logging with mutex protection
  • Automatic timestamps in human-readable format
  • Process and thread ID tracking
  • Debug mode with file/line information

Usage Example

Log_Manager log(stderr);
// Use macro for automatic file/line in debug mode
WRITE_IN_LOG(log, "Processing item %d", item_id);
// Output: "Mon Jan 01 2024 12:00:00 PM (12345:6789): Processing item 42"
Thread-safe log manager with timestamps.
Definition log.H:92
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_log_function > > log(const __gmp_expr< T, U > &expr)
Definition gmpfrxx.h:4063
#define WRITE_IN_LOG(log, format...)
Macro to write to log with automatic file/line in debug mode.
Definition log.H:227
See also
useMutex.H Mutex utilities
Author
Leandro Rabindranath León

Definition in file log.H.

Macro Definition Documentation

◆ WRITE_IN_LOG

#define WRITE_IN_LOG (   log,
  format... 
)    log.write_line(format)

Macro to write to log with automatic file/line in debug mode.

Parameters
logLog_Manager instance
formatPrintf-style format and arguments

Definition at line 227 of file log.H.