libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1//
2// Created by claunia on 13/8/25.
3//
4
5#ifndef LIBAARUFORMAT_LOG_H
6#define LIBAARUFORMAT_LOG_H
7
8#include <stdarg.h>
9#include <stdio.h>
10
11// Uncomment to enable tracing
12// #define ENABLE_TRACE
13// Uncomment to use slog instead of stderr
14// #define USE_SLOG
15
16#ifdef ENABLE_TRACE
17#ifdef USE_SLOG
18#include "slog.h"
19
20#define TRACE(fmt, ...) slog_trace(fmt, ##__VA_ARGS__)
21#else
22#define TRACE(fmt, ...) fprintf(stderr, "[TRACE] %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__)
23#endif
24#else
25#define TRACE(fmt, ...)
26#endif
27
28#include <stdarg.h>
29#include <stdio.h>
30
31#ifdef ENABLE_FATAL
32#ifdef USE_SLOG
33#include "slog.h"
34
35#define FATAL(fmt, ...) slog_fatal(fmt, ##__VA_ARGS__)
36#else
37#define FATAL(fmt, ...) fprintf(stderr, "[FATAL] %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__)
38#endif
39#else
40#define FATAL(fmt, ...)
41#endif
42
43#endif // LIBAARUFORMAT_LOG_H