Skip to content

Commit e41832a

Browse files
committed
Logging library: better API documentation
1 parent d5d1694 commit e41832a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

lib/ddlog_log.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* `module` - Opaque module identifier. Can represent module, subsystem, log
99
* stream, etc.
1010
* `cb` - Callback to be invoked for each log message with the given module
11-
* id and log level `<= max_level`.
11+
* id and log level `<= max_level`. Passing `NULL` disables
12+
* logging for the given module.
1213
* `max_level` - Don't invoke the callback for messages whoe log level is
1314
* `> max_level`.
1415
*/

lib/log.dl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ typedef log_level_t = signed<32>
8484
* `level` - log level
8585
* `msg` - error message (UTF-8)
8686
*
87-
* Always returns `true`.
87+
* This function returns a `bool` so that it can be used as a filter inside
88+
* DDlog rules. It always returns `true`.
8889
*/
8990
extern function log(module: module_t, level: log_level_t, msg: string): bool

lib/log.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ lazy_static! {
1515

1616
/*
1717
* Logging API exposed to the DDlog program.
18+
* (see detailed documentation in `log.dl`)
1819
*/
1920
pub fn log_log(module: &log_module_t, level: &log_log_level_t, msg: &String) -> bool
2021
{
@@ -27,7 +28,10 @@ pub fn log_log(module: &log_module_t, level: &log_log_level_t, msg: &String) ->
2728
}
2829

2930
/*
30-
* Configuration API.
31+
* Configuration API
32+
* (detailed documentation in `ddlog_log.h`)
33+
*
34+
* `cb = None` - disables logging for the given module.
3135
*
3236
* NOTE: we set callback and log level simultaneously. A more flexible API
3337
* would allow changing log level without changing the callback.

0 commit comments

Comments
 (0)