libmemalloc
v4.0.00
Modern Memory Allocator
|
Logging macros and configuration for libmemalloc. More...
#include <errno.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
Go to the source code of this file.
Macros | |
#define | LOG_LEVEL LOG_LEVEL_DEBUG |
Default log level if not defined. | |
#define | _POSIX_C_SOURCE 200809UL |
Expose POSIX extensions for clock_gettime and pthread mutex initializer. | |
#define | LOG_PRINTF(file, ...) fprintf(file, __VA_ARGS__) |
Compiler-specific printf abstraction. | |
#define | LOG_VPRINTF(file, fmt, args) vfprintf(file, fmt, args) |
Compiler-specific vprintf abstraction. | |
#define | PREFIX_ERROR "[ERROR]" |
#define | PREFIX_WARNING "[WARNING]" |
#define | PREFIX_INFO "[INFO]" |
#define | PREFIX_DEBUG "[DEBUG]" |
#define | COLOR_RED "\033[0;31m" |
#define | COLOR_YELLOW "\033[0;33m" |
#define | COLOR_BLUE "\033[0;34m" |
#define | COLOR_GREEN "\033[0;32m" |
#define | COLOR_RESET "\033[0m" |
#define | ATTR_PRINTF(fmt_idx, var_idx) __attribute__((format(printf, fmt_idx, var_idx))) |
Macro to apply GCC printf-style format checking on custom functions. | |
#define | LOG_ERROR(fmt, ...) |
Logs an error message (red). | |
#define | LOG_WARNING(fmt, ...) |
Logs a warning message (yellow). | |
#define | LOG_INFO(fmt, ...) |
Logs an info message (blue). | |
#define | LOG_DEBUG(fmt, ...) |
Logs a debug message (green). | |
Enumerations | |
enum | log_level_t { LOG_LEVEL_NONE = (uint8_t)(0u) , LOG_LEVEL_ERROR = (uint8_t)(1u) , LOG_LEVEL_WARNING = (uint8_t)(2u) , LOG_LEVEL_INFO = (uint8_t)(3u) , LOG_LEVEL_DEBUG = (uint8_t)(4u) } |
Defines log levels for the logging system. More... | |
Functions | |
static int | LOG_output (log_level_t level, const char *color, const char *prefix, const char *file, const char *func, int line, const char *fmt,...) __attribute__((format(printf |
Internal logging implementation: threadâsafe, prints timestamp, optional ANSI color, severity prefix, formatted message, and source location. | |
Logging macros and configuration for libmemalloc.
Provides logging utilities for libmemalloc, including log level control (ERROR, WARNING, INFO, DEBUG), ANSI color output, and automatic file, function, and line reporting for each log entry. Supports GCC-specific built-in printing as well as standard printf for other compilers.