@@ -31,33 +31,46 @@ Resulting in a line with the given format printed to stderr:
31
31
```
32
32
33
33
34
- #### log_set_quiet(int enable)
35
- Quiet-mode can be enabled by passing ` 1 ` to the ` log_set_quiet() ` function.
36
- While this mode is enabled the library will not output anything to stderr, but
37
- will continue to write to the file if one is set.
34
+ #### log_set_quiet(bool enable)
35
+ Quiet-mode can be enabled by passing ` true ` to the ` log_set_quiet() ` function.
36
+ While this mode is enabled the library will not output anything to ` stderr ` , but
37
+ will continue to write to files and callbacks if any are set.
38
38
39
39
40
40
#### log_set_level(int level)
41
41
The current logging level can be set by using the ` log_set_level() ` function.
42
- All logs below the given level will be ignored . By default the level is
43
- ` LOG_TRACE ` , such that nothing is ignored.
42
+ All logs below the given level will not be written to ` stderr ` . By default the
43
+ level is ` LOG_TRACE ` , such that nothing is ignored.
44
44
45
45
46
- #### log_set_fp (FILE * fp)
47
- A file pointer where the log should be written can be provided to the library by
48
- using the ` log_set_fp ()` function. The data written to the file output is
49
- of the following format:
46
+ #### log_add_fp (FILE * fp, int level )
47
+ One or more file pointers where the log will be written can be provided to the
48
+ library by using the ` log_add_fp ()` function. The data written to the file
49
+ output is of the following format:
50
50
51
51
```
52
52
2047-03-11 20:18:26 TRACE src/main.c:11: Hello world
53
53
```
54
54
55
+ Any messages below the given ` level ` are ignored. If the library failed to add a
56
+ file pointer a value less-than-zero is returned.
55
57
56
- #### log_set_lock(log_LockFn fn)
58
+
59
+ #### log_add_callback(log_LogFn fn, void * udata, int level)
60
+ One or more callback functions which are called with the log data can be
61
+ provided to the library by using the ` log_add_callback() ` function. A callback
62
+ function is passed a ` log_Event ` structure containing the ` line ` number,
63
+ ` filename ` , ` fmt ` string, ` va ` printf va\_ list, ` level ` and the given ` udata ` .
64
+
65
+
66
+ #### log_set_lock(log_LockFn fn, void * udata)
57
67
If the log will be written to from multiple threads a lock function can be set.
58
- The function is passed a ` udata ` value (set by ` log_set_udata() ` ) and the
59
- integer ` 1 ` if the lock should be acquired or ` 0 ` if the lock should be
60
- released.
68
+ The function is passed the boolean ` true ` if the lock should be acquired or
69
+ ` false ` if the lock should be released and the given ` udata ` value.
70
+
71
+
72
+ #### const char* log_level_string(int level)
73
+ Returns the name of the given log level as a string.
61
74
62
75
63
76
#### LOG_USE_COLOR
0 commit comments