diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2020-11-24 15:15:11 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2020-11-24 15:22:42 -0700 |
commit | ecbcb2509f4b811bce0a56e07de9737d14815251 (patch) | |
tree | f96492fb6db5d26c133dc3ab2993a9df3f224ea2 /src/kern/log.c | |
parent | 351ff7059a5bacb322664412a8c62ee4640b33bf (diff) | |
download | stm32l4-ecbcb2509f4b811bce0a56e07de9737d14815251.tar.gz stm32l4-ecbcb2509f4b811bce0a56e07de9737d14815251.tar.bz2 stm32l4-ecbcb2509f4b811bce0a56e07de9737d14815251.zip |
Add better logging capabilities, including the ability to panic.
Diffstat (limited to 'src/kern/log.c')
-rw-r--r-- | src/kern/log.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/kern/log.c b/src/kern/log.c index ebc2cbe..c876759 100644 --- a/src/kern/log.c +++ b/src/kern/log.c @@ -26,7 +26,27 @@ void klogf(const char* fmt, ...) va_list l; va_start(l, fmt); + kvlogf(fmt, l); +} + +void kvlogf(const char* fmt, va_list l) +{ + usart_vprintf(&USART2, fmt, l); +} + +void kerr_vlogf(const char* fmt, va_list l) +{ + klogf("\x1b[01;31m[ERROR] "); usart_vprintf(&USART2, fmt, l); + klogf("\x1b[00m"); +} + +void kerr_logf(const char* fmt, ...) +{ + va_list l; + va_start(l, fmt); + + kerr_vlogf(fmt, l); } void setup_usart2(uint32_t baud_rate) |