Skip to content

Commit 9e44c24

Browse files
committed
Updated README
1 parent 4c5da21 commit 9e44c24

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

README.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,46 @@ Resulting in a line with the given format printed to stderr:
3131
```
3232

3333

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.
3838

3939

4040
#### log_set_level(int level)
4141
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.
4444

4545

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:
5050

5151
```
5252
2047-03-11 20:18:26 TRACE src/main.c:11: Hello world
5353
```
5454

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.
5557

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)
5767
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.
6174

6275

6376
#### LOG_USE_COLOR

0 commit comments

Comments
 (0)