You can have a driver send log messages to the
syslog through the use of the
zxlogf(<log_level>,...)
macro, which is defined in
lib/ddk/debug.h.
Depending on the type of log level, by default, log messages are sent to the following logs:
- syslog:
ERROR
WARNING
INFO
To control which log levels are sent to the syslog
, you can use the
platform configuration in product assembly. An assembly
platform configuration can be specified in either the product or through
developer overrides for product assembly.
To set this through developer overrides for product assembly, use the
following in //local/BUILD.gn
:
# //local/BUILD.gn:
assembly_developer_overrides("sdhci-debug-logs") {
platform = {
diagnostics = {
component_log_initial_interests = [
{
component = "fuchsia-boot:///sdhci#meta/sdhci.cm"
log_severity = "debug"
},
]
}
}
}
Then use fx set
to set the assembly-override
:
fx set <product.board> --assembly-override=//local:sdhci-debug-logs
Additionally, this enables DEBUG
and TRACE
logs for the sdhci driver, as we
are setting a minimum log level, and TRACE
is lower than DEBUG
.
A driver's logs are tagged with the process name, "driver", and the driver name. This can be used to filter the output of the syslog whilst searching for particular logs.