summaryrefslogtreecommitdiffstats
path: root/include/printk.h
Commit message (Collapse)AuthorAgeFilesLines
* commands: dmesg: add -l option to restrict output levelOleksij Rempel2019-02-271-5/+15
| | | | | | | | | Same as linux dmesg, barebox dmesg will be able to restrict output level by using -l option. For example "dmesg -l err,warn" This functionality can be used for test automation. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: dmesg: add print raw parameterOleksij Rempel2019-02-271-0/+1
| | | | | | | | | | | | | | | | | Add -r option to mimic functionality of linux dmesg. It will prefix log level and timestamp to each buffer: <6>[ 460us] barebox 2019.02.0-00266-g6aea757067-dirty #355 Thu Feb 21 11:51:43 CET 2019 <6>[ 6279us] Board: DPTechnics DPT-Module <6>[ 209281us] mdio_bus: miibus0: probed <6>[ 210184us] ag71xx-gmac 18070000.mac@19000000.of: network device registered <6>[ 216051us] m25p80 w25q128@00: w25q128 (16384 Kbytes) <6>[ 219913us] netconsole: registered as netconsole-1 <6>[ 223312us] malloc space: 0x80c00000 -> 0x80ffffff (size 4 MiB) <6>[ 228255us] eth0: got preset MAC address: c4:93:00:00:ae:89 <6>[ 246363us] running /env/bin/init... Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* printk: Pass groupsize to memory_display() in print_hex_dump()Andrey Smirnov2019-01-091-1/+1
| | | | | | | | | Don't hardcode grouping data into 4-byte words in print_hex_dump() implementation and instead pass 'groupsize' to memory_display(), since that's what that parameter is for. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add pr_memory_displaySascha Hauer2018-12-031-0/+8
| | | | | | | | | pr_memory_display is a memory_display variant that takes a MSG_* loglevel priority with which the hexdump is printed. Like the normal pr_* function this is optimized out when the priority is below the compile time priority. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* memory_display: move prototype to include/printk.hSascha Hauer2018-12-031-0/+11
| | | | | | | It's where the kernel has the print_hex_dump prototypes aswell, it's a better match for these. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* printk: make line continuation not result in stray emergency errorsRoland Hieber2018-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The levels of pr_emerg() and pr_cont() are both set to 0. When pr_cont() is used to continue a previous line, and colored console output is enabled, this can result in garbled log messages being printed, e.g.: ERROR: HABv4: -------- HAB warning Event 0 -------- ERROR: HABv4: event data: ERROR: HABv4: dbEMERG: 00EMERG: 24EMERG: 42EMERG: 69EMERG: 30EMERG: e1EMERG: 1d ERROR: HABv4: 00EMERG: 04EMERG: 00EMERG: 02EMERG: 40EMERG: 00EMERG: 36EMERG: 06 ERROR: HABv4: 55EMERG: 55EMERG: 00EMERG: 03EMERG: 00EMERG: 00EMERG: 00EMERG: 00 ERROR: HABv4: 00EMERG: 00EMERG: 00EMERG: 00EMERG: 00EMERG: 00EMERG: 00EMERG: 00 ERROR: HABv4: 00EMERG: 00EMERG: 00EMERG: 01EMERG: ERROR: HABv4: Status: Operation completed with warning (0x69) Note the additional "EMERG: " in front of each continuation, which is inserted by pr_cont(buf) being expanded to pr_printk(0, buf). These additional strings show up in deep red on the console (which is not supported in Git commit messages…). One might argue that this is the same color as the "ERROR: " prefix, but when pr_cont() is used with pr_notice() and pr_warning(), which are printed in blue and yellow respectively, at least then the change in color would lead to additional confusion. The log level argument to pr_printk is defined as int, so we can solve this by defining the level for pr_cont() to -1, which is not used for any loglevel: ERROR: HABv4: -------- HAB warning Event 0 -------- ERROR: HABv4: event data: ERROR: HABv4: db 00 24 42 69 30 e1 1d ERROR: HABv4: 00 04 00 02 40 00 36 06 ERROR: HABv4: 55 55 00 03 00 00 00 00 ERROR: HABv4: 00 00 00 00 00 00 00 00 ERROR: HABv4: 00 00 00 01 ERROR: HABv4: Status: Operation completed with warning (0x69) Fixes: 0fcefdd9369050f35a88b41dcd42cc5a3c6c6b33 ("printk: Add pr_cont") Fixes: ea0e077ed65a003e4d7a1e023aee38cbe2d14898 ("printk: Fix pr_cont") Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* vsprintf: implement %pVSascha Hauer2018-10-081-0/+5
| | | | | | | %pV allows to pass in a struct va_format as a pointer. UBIFS uses this for its logging functions, but it may be useful in other places aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* printk: Fix pr_contSascha Hauer2016-07-221-1/+1
| | | | | | | pr_cont is meant to continue a line, so do not printf the prefix given with pr_fmt() again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* printk: Add pr_contAlexander Stein2016-04-081-0/+1
| | | | | | | This is needed by upcoming UBIFS update. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* printk: Add printk_onceAlexander Stein2016-04-081-0/+10
| | | | | | | This is needed by upcoming list_sort implementation. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* printk: Add missing include/declarationMarkus Pargmann2015-12-101-0/+3
| | | | | | | There are functions or structs used that do need these. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add PBL console supportSascha Hauer2015-01-051-5/+10
| | | | | | | | | | | This adds simple console support to the PBL which makes it possible to print more complex messages in the PBL than just strings or hex numbers. For now puts_ll is used to print the messages, so it depends on CONFIG_DEBUG_LL which makes it more a debugging option. However, this could be extended later to get regular output from the PBL if desired. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: Fix CONSOLE_NONE supportSascha Hauer2014-10-081-0/+12
| | | | | | | | Without console support we need a static inline version of pr_print and dev_printf, otherwise we get link errors. Reported-by: Kevin Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce message logging supportSascha Hauer2014-09-301-0/+17
| | | | | | | | | | This adds a buffer for log messages and a 'dmesg' command to print the messages. The log buffer is implemented as log objects rather than a string buffer. This makes it easy to implement limiting the messages, cleaning the buffer and timestamping the messages. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce verbose debugSascha Hauer2014-07-171-1/+7
| | | | | | | | During debugging it sometimes helps to me even more verbose. This adds an additional debug level for this. Also we remove an already existing pr_vdebug definition in the USB gadget u_serial driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce runtime loglevelSascha Hauer2013-09-291-3/+6
| | | | | | | With this the verbosity of barebox can be controlled during runtime using the 'loglevel' globalvar. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include/printk: fix level of pr_err and pr_warningHubert Feurstein2013-07-221-2/+2
| | | | | | | The level of pr_err and pr_warning were interchanged. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fix another brown paper bag bug introduced with compile time loglevelSascha Hauer2013-03-061-4/+1
| | | | | | | | | | __pr_printk is a define which uses a local variable 'ret'. This means that whenever someone does a pr_*("ret: %d\n", ret); ret will be 0. Fix this by writing this without a local variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fix brown paper bag bug introduced with compile time loglevelSascha Hauer2013-02-151-4/+1
| | | | | | | | | | __dev_printf is a define which uses a local variable 'ret'. This means that whenever someone does a dev_*(dev, "ret: %d\n", ret); ret will be 0. Fix this by writing this without a local variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce pr_fmtSascha Hauer2013-01-271-9/+13
| | | | | | | | | | With this the files can give more context to their pr_* messages by specifying a at the beginning of the files. Basically the same mechanism as in the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce compile time loglevelSascha Hauer2013-01-271-28/+38
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* consolidate print* in a single headerJean-Christophe PLAGNIOL-VILLARD2013-01-271-0/+58
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>