Show the function name in log messages by default. This value can
be overridden using the 'log format' command.
+config LOGF_FUNC_PAD
+ int "Number of characters to use for function"
+ default 20
+ help
+ Sets the field width to use when showing the function. Set this to
+ a larger value if you have lots of long function names, and want
+ things to line up.
+
config LOG_SYSLOG
bool "Log output to syslog server"
depends on NET
if (fmt & BIT(LOGF_LINE))
printf("%d-", rec->line);
if (fmt & BIT(LOGF_FUNC))
- printf("%s()", rec->func);
+ printf("%*s()", CONFIG_LOGF_FUNC_PAD, rec->func);
}
if (fmt & BIT(LOGF_MSG))
printf("%s%s", add_space ? " " : "", rec->msg);
for (i = min; i <= max; i++) {
if (flags & EXPECT_LOG)
- ut_assert_nextline("do_log_run() log %d", i);
+ ut_assert_nextline(" do_log_run() log %d", i);
if (flags & EXPECT_DIRECT)
- ut_assert_nextline("func() _log %d", i);
+ ut_assert_nextline(" func() _log %d", i);
if (flags & EXPECT_DEBUG) {
ut_assert_nextline("log %d", i);
ut_assert_nextline("_log %d", i);
}
if (flags & EXPECT_EXTRA)
for (; i <= LOGL_MAX ; i++)
- ut_assert_nextline("func() _log %d", i);
+ ut_assert_nextline(" func() _log %d", i);
for (i = LOGL_FIRST; i < LOGL_COUNT; i++) {
if (flags & EXPECT_FORCE)
- ut_assert_nextline("func() _log force %d", i);
+ ut_assert_nextline(" func() _log force %d",
+ i);
if (flags & EXPECT_DEBUG)
ut_assert_nextline("_log force %d", i);
}
log_io("level %d\n", LOGL_DEBUG_IO);
for (i = LOGL_EMERG; i <= _LOG_MAX_LEVEL; i++)
- ut_assert_nextline("%s() level %d", __func__, i);
+ ut_assert_nextline("%*s() level %d", CONFIG_LOGF_FUNC_PAD,
+ __func__, i);
ut_assert_console_end();
return 0;
}
{
ut_assertok(console_record_reset_enable());
log_err("default\n");
- ut_assert_nextline("%s() default", __func__);
+ ut_assert_nextline("%*s() default", CONFIG_LOGF_FUNC_PAD, __func__);
ut_assertok(log_device_set_enable(LOG_GET_DRIVER(console), false));
log_err("disabled\n");
ut_assertok(log_device_set_enable(LOG_GET_DRIVER(console), true));
log_err("enabled\n");
- ut_assert_nextline("%s() enabled", __func__);
+ ut_assert_nextline("%*s() enabled", CONFIG_LOGF_FUNC_PAD, __func__);
ut_assert_console_end();
return 0;
}