Module ulog
Lua API for utrace
utrace stands for uC-tracer and is a light-weight tracer for C which works
on everything from bare-silicon deeply embedded systems, to high-end OS:es
like Linux.
Central part of utrace are it's probes. With probes in place,
SW can be not only traced, but also extend loggers like liblog to have
their other-wise compile-time behaviour hard-coded in, to become modified in
run-time. It can probably be made to operate as normal Lua module but was
designed to integrated into a Lua-VM (see xb-lua below).
This module is a refined external API for utrace that has it's own native
lower-level API here:
- utrace-probe
- utrace-rpc
See also (project home-sites)
Info:
- Copyright: © Michael Ambrus 2024
- License: MIT
- Author: Michael Ambrus michael@ambrus.se
Functions
| version () | version string |
| settings () | Get tplog settings into a "json" table |
| set_settings () | Set tplog settings |
| send (V, Message) | Send log
Test-API to send a liblog log-message of certain type Disable syslog or close it (if opened) Which type determined by the first argument. |
| log (verbose, Message) | Send log message
Test-API to send a tplog log-message of certain type. |
Functions
- version ()
-
version string
Returns:
-
string
version
- settings ()
-
Get tplog settings into a "json" table Each table index is a tuple:
["name" : value]
Returns:
- integer number settings
- table tuple-table with settings
Usage:
Each tuple in settings-table: --[[ 1. (enum) logtype 0=LOGTYPE_ANDROID, 1=LOGTYPE_LINUX 2. (bool) deco_probeid Additional decoration (wrt liblog) including probe-ID for convenience --]]
-- Example: n,s = ulog.settings() for i=1,n do print(s[i][1], s[i][2]) end
- set_settings ()
-
Set tplog settings Each argument has the same meaning and order as the table from settings()
Returns:
-
boolean
success
See also:
- send (V, Message)
-
Send log
Test-API to send a liblog log-message of certain type Disable syslog or close it (if opened)
Which type determined by the first argument. Second argument enables copy syslog to stderr. It's ignored if not enabling syslog operation.
Parameters:
- V integer =0, D=1, I=2, W=3, E=4, C=5
- Message string
Returns:
-
boolean
OK
- log (verbose, Message)
-
Send log message
Test-API to send a tplog log-message of certain type. This API is routed though tplog API with much more control and decoration liblog's native API.
Which type determined by the first argument.
Parameters:
Returns:
-
boolean
OK