The pmloglib provides the API, which enables applications to format the messages and put these messages to the syslog.
Overview of the API(click to expand)
This library supports instrumenting code to produce runtime text output to indicate run status.
We differentiate output into two types, tracing and logging.
Tracing code is for detailed debugging for use by individual component development. It is turned on only locally and only as needed, and is not included in the main build or release product. The system that supports for tracing code will not be as efficient in this case as it will lean more towards ease of use.
Logging code, on the other hand, is included in the main build and release product. The purpose is to log errors and important diagnostics information in the device logs.
Logging code may also support more verbose diagnostic levels which may be turned on dynamically as needed on the device. The intent of the system is that logging code which is not enabled has minimal performance impact. In particular, a logging call which is not enabled should not result in a library call or evaluation of parameters.
This is enabled by requiring logging clients to initialize a logging context that is managed by the PmLog system. The context includes a memory field that can be quickly checked by the logging call to know whether the call is enabled.
The pmloglib service provides the following core features:
- Context support
- Filter messages by id
- Route messages by parameters
- Provides C API for other components
- Provide configuration through the pmlogctl utility
The pmloglib supports contexts. Through the pmloglib API, you can configure the contexts, use different files for different contexts and manage the filtering level.
By default, the pmloglib provides 2 contexts:
- Executable files
- Dynamic libraries that are used by the executable file
The messages are formatted on the key - value basis. The key serves as a tag, by using which it is possible to get all messages that are marked by a certain key.
// Get a pointer to the context for this component.
// The context is created if it does not already exist.
PmLogDebug(gMyContext, "Calling Foo");
err = Foo();
PmLogError(gMyContext, "FOOERR", 1, PMLOGKFV(ERROR_CODE,"%d",err), "");
Below are the list of functions which are exported :
# Exported functions
### Public interface (PmLogLib.h) ###
### Private interface (PmLogLibPrv.h) ###