comparison libmlk-core/core/trace.h @ 243:71b3b7036de7

misc: lot of cleanups, - prefix libraries with libmlk, - move assets from source directories closes #2520, - prefix header guards closes #2519
author David Demelier <markand@malikania.fr>
date Sat, 28 Nov 2020 22:37:30 +0100
parents libcore/core/trace.h@dd7c8d4321a3
children c4da052c0def
comparison
equal deleted inserted replaced
242:4c24604efcab 243:71b3b7036de7
1 /*
2 * trace.h -- non-fatal message logs
3 *
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef MOLKO_CORE_TRACE_H
20 #define MOLKO_CORE_TRACE_H
21
22 /**
23 * \file trace.h
24 * \brief Non-fatal message logs.
25 *
26 * The purpose of this module is to provide a feedback from the code when there
27 * are non-fatal programming error or unexpected results. In contrast to the
28 * \ref debug.h module this one is always activated no manner if the build
29 * is in Debug or Release.
30 *
31 * For example, having an animation with a delay of 0 is not a technical issue
32 * but is probably not what the use wants. Thus, a trace warning may be
33 * generated in that way.
34 */
35
36 #include <stdarg.h>
37
38 /**
39 * \brief Maximum length for a trace log.
40 */
41 #define TRACE_LINE_MAX (1024)
42
43 /**
44 * \brief Global trace handler.
45 *
46 * The default one use a simple printf on the standard output.
47 */
48 extern void (*trace_handler)(const char *);
49
50 /**
51 * Log some information.
52 *
53 * \pre fmt != NULL
54 * \param fmt the printf(3) format string
55 */
56 void
57 tracef(const char *fmt, ...);
58
59 /**
60 * Similar to \ref tracef with a va_list arguments pointer.
61 *
62 * \pre fmt != NULL
63 * \param fmt the printf(3) format string
64 * \param ap the argument list
65 */
66 void
67 vtracef(const char *fmt, va_list ap);
68
69 #endif /* !MOLKO_CORE_TRACE_H */