Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_nodup_log.h
Go to the documentation of this file.
1/*
2 * Nilorea Library
3 * Copyright (C) 2005-2026 Castagnier Mickael
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
26#ifndef __NO_DUP_LOG_HEADER_GUARD__
27#define __NO_DUP_LOG_HEADER_GUARD__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
38#include "n_common.h"
39#include "n_log.h"
40#include "n_str.h"
41#include "n_list.h"
42#include "n_hash.h"
43
45int init_nodup_log(size_t max);
49int close_nodup_log();
50
52#define n_nodup_log(__LEVEL__, ...) \
53 do { \
54 _n_nodup_log(__LEVEL__, __FILE__, __func__, __LINE__, __VA_ARGS__); \
55 } while (0)
56
58#define n_nodup_log_indexed(__LEVEL__, __PREF__, ...) \
59 do { \
60 _n_nodup_log_indexed(__LEVEL__, __PREF__, __FILE__, __func__, __LINE__, __VA_ARGS__); \
61 } while (0)
62
64void _n_nodup_log(int LEVEL, const char* file, const char* func, int line, const char* format, ...);
66void _n_nodup_log_indexed(int LEVEL, const char* prefix, const char* file, const char* func, int line, const char* format, ...);
68int dump_nodup_log(char* file);
69
74#ifdef __cplusplus
75}
76#endif
77#endif
int init_nodup_log(size_t max)
init the nodup log internal hash table
Definition n_nodup_log.c:54
int dump_nodup_log(char *file)
dump the nodup log hash table to a file in human-readable form
int close_nodup_log()
close the nodup log session
Definition n_nodup_log.c:87
void _n_nodup_log(int LEVEL, const char *file, const char *func, int line, const char *format,...)
log a message only once per unique location
int empty_nodup_table()
empty the nodup table
Definition n_nodup_log.c:78
void _n_nodup_log_indexed(int LEVEL, const char *prefix, const char *file, const char *func, int line, const char *format,...)
log a message only once per unique prefix and location
Common headers and low-level functions & define.
Hash functions and table.
List structures and definitions.
Generic log system.
N_STR and string function declaration.