-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmodule.ae
More file actions
40 lines (33 loc) · 1.13 KB
/
Copy pathmodule.ae
File metadata and controls
40 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// std.log - Logging Module
// Import with: import std.log
// Log level constants
// LOG_LEVEL_DEBUG = 0, LOG_LEVEL_INFO = 1, LOG_LEVEL_WARN = 2
// LOG_LEVEL_ERROR = 3, LOG_LEVEL_FATAL = 4
exports(
log_init_raw, log_shutdown, log_write,
log_set_level, log_set_colors, log_set_timestamps,
log_get_stats, log_print_stats,
init
)
// Initialize and shutdown. Raw init returns 1/0 for ok/file-open-failed.
extern log_init_raw(filename: string, min_level: int) -> int
extern log_shutdown()
// Core logging (variadic not fully supported, use with format string)
extern log_write(level: int, msg: string)
// Configuration
extern log_set_level(level: int)
extern log_set_colors(enabled: int)
extern log_set_timestamps(enabled: int)
// Statistics
extern log_get_stats() -> ptr
extern log_print_stats()
// Initialize logging. Returns "" on success, error string if the
// requested log file could not be opened (in which case logging still
// works via stderr as a fallback).
init(filename: string, min_level: int) -> {
ok = log_init_raw(filename, min_level)
if ok == 0 {
return "cannot open log file"
}
return ""
}