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 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * permissions and limitations under the License.
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 */
19
27#ifndef __NO_DUP_LOG_HEADER_GUARD__
28#define __NO_DUP_LOG_HEADER_GUARD__
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
39#include "n_common.h"
40#include "n_log.h"
41#include "n_str.h"
42#include "n_list.h"
43#include "n_hash.h"
44
46int init_nodup_log(size_t max);
50int close_nodup_log();
51
53#define n_nodup_log(__LEVEL__, ...) \
54 do { \
55 _n_nodup_log(__LEVEL__, __FILE__, __func__, __LINE__, __VA_ARGS__); \
56 } while (0)
57
59#define n_nodup_log_indexed(__LEVEL__, __PREF__, ...) \
60 do { \
61 _n_nodup_log_indexed(__LEVEL__, __PREF__, __FILE__, __func__, __LINE__, __VA_ARGS__); \
62 } while (0)
63
65void _n_nodup_log(int LEVEL, const char* file, const char* func, int line, const char* format, ...);
67void _n_nodup_log_indexed(int LEVEL, const char* prefix, const char* file, const char* func, int line, const char* format, ...);
69int dump_nodup_log(char* file);
70
75#ifdef __cplusplus
76}
77#endif
78#endif
int init_nodup_log(size_t max)
init the nodup log internal hash table
Definition n_nodup_log.c:55
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:88
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:79
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.