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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use *;
use cratelog;
/// Primitive API for sending a log message using the current logger.
///>
///> Returns `DQCS_SUCCESS` if logging was successful, or `DQCS_FAILURE` if no
///> logger is available in the current thread or one of the arguments could not
///> be converted. Loggers are available in the simulation host thread and in
///> threads running plugins.
///>
///> ## Formatting and fallback to stderr
///>
///> As an alternative to this function, you can also use `dqcs_log_format()`.
///> This function differs from `dqcs_log_raw()` in two ways:
///>
///> - Instead of the `message` string, a printf-style format string and
///> associated varargs are passed to construct the message.
///> - When logging fails, this function falls back to writing to `stderr`
///> instead of returning the errors.
///>
///> ## Macros
///>
///> From C and C++, these functions are normally not called directly. Instead,
///> the following macros are used:
///>
///> ```C
///> dqcs_log_trace("trace message!");
///> dqcs_log_debug("debug message!");
///> dqcs_log_info("info message!");
///> dqcs_log_note("notice!");
///> dqcs_log_warn("warning!");
///> dqcs_log_error("error!");
///> dqcs_log_fatal("fatal error!");
///> ```
///>
///> These macros automatically set `file` to the C source filename and `line`
///> to the line number. `module` is hardcoded to "C" or "CPP" depending on
///> source file language. They use `dqcs_log_format()`, so they also support
///> printf-style formatting. For instance:
///>
///> ```C
///> dqcs_note("answer to %s: %d", "ultimate question", 42);
///> ```
pub extern "C"