*/
#if CONFIG_IS_ENABLED(LOG)
#define _LOG_MAX_LEVEL CONFIG_VAL(LOG_MAX_LEVEL)
+#define log_err(_fmt...) log(LOG_CATEGORY, LOGL_ERR, ##_fmt)
+#define log_warning(_fmt...) log(LOG_CATEGORY, LOGL_WARNING, ##_fmt)
+#define log_notice(_fmt...) log(LOG_CATEGORY, LOGL_NOTICE, ##_fmt)
+#define log_info(_fmt...) log(LOG_CATEGORY, LOGL_INFO, ##_fmt)
+#define log_debug(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG, ##_fmt)
+#define log_content(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG_CONTENT, ##_fmt)
+#define log_io(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
#else
#define _LOG_MAX_LEVEL LOGL_INFO
+#define log_err(_fmt...)
+#define log_warning(_fmt...)
+#define log_notice(_fmt...)
+#define log_info(_fmt...)
+#define log_debug(_fmt...)
+#define log_content(_fmt...)
+#define log_io(_fmt...)
#endif
/* Emit a log record if the level is less that the maximum */
return ret;
break;
}
+ case 10: {
+ log_err("level %d\n", LOGL_EMERG);
+ log_err("level %d\n", LOGL_ALERT);
+ log_err("level %d\n", LOGL_CRIT);
+ log_err("level %d\n", LOGL_ERR);
+ log_warning("level %d\n", LOGL_WARNING);
+ log_notice("level %d\n", LOGL_NOTICE);
+ log_info("level %d\n", LOGL_INFO);
+ log_debug("level %d\n", LOGL_DEBUG);
+ log_content("level %d\n", LOGL_DEBUG_CONTENT);
+ log_io("level %d\n", LOGL_DEBUG_IO);
+ break;
+ }
}
return 0;
lines = run_test(9)
check_log_entries(lines, 3)
+ def test10():
+ lines = run_test(10)
+ for i in range(7):
+ assert 'log_test() level %d' % i == lines.next()
+
# TODO(sjg@chromium.org): Consider structuring this as separate tests
cons = u_boot_console
test0()
test7()
test8()
test9()
+ test10()
@pytest.mark.buildconfigspec('cmd_log')
def test_log_format(u_boot_console):