diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-02-04 21:03:37 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-02-04 21:03:37 -0700 |
commit | 5c373cfe544df4ddba44adf3f6b60399340e4bd5 (patch) | |
tree | f96f5c57bbb042b3962bed49853621f6d344de04 /libmisc | |
parent | 65f2a6fb8797385e06e61e13bac7a33d27f2097d (diff) | |
parent | 57d4c9f154cacd5d0dcc2f45033d784b3e0b6734 (diff) |
Merge branch 'lukeshu/9p-exit'
Diffstat (limited to 'libmisc')
-rw-r--r-- | libmisc/include/libmisc/log.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libmisc/include/libmisc/log.h b/libmisc/include/libmisc/log.h index 121b0e1..79c0ab6 100644 --- a/libmisc/include/libmisc/log.h +++ b/libmisc/include/libmisc/log.h @@ -1,6 +1,6 @@ /* libmisc/log.h - stdio logging * - * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later */ @@ -12,25 +12,23 @@ #include <libmisc/macro.h> #include <libmisc/_intercept.h> -#ifndef LOG_NAME - #error "each compilation unit that includes <libmisc/log.h> must define LOG_NAME" -#endif - #ifdef NDEBUG #define _LOG_NDEBUG 1 #else #define _LOG_NDEBUG 0 #endif +const char *const_byte_str(uint8_t b); + #define n_errorf(nam, fmt, ...) do { __lm_printf("error: " LM_STR_(nam) ": " fmt "\n" __VA_OPT__(,) __VA_ARGS__); } while (0) #define n_infof(nam, fmt, ...) do { __lm_printf("info : " LM_STR_(nam) ": " fmt "\n" __VA_OPT__(,) __VA_ARGS__); } while (0) #define n_debugf(nam, fmt, ...) do { if (LM_CAT3_(CONFIG_, nam, _DEBUG) && !_LOG_NDEBUG) \ __lm_printf("debug: " LM_STR_(nam) ": " fmt "\n" __VA_OPT__(,) __VA_ARGS__); } while (0) +#endif /* _LIBMISC_LOG_H_ */ + +#if defined(LOG_NAME) && !defined(errorf) #define errorf(fmt, ...) n_errorf(LOG_NAME, fmt, __VA_ARGS__) #define infof(fmt, ...) n_infof(LOG_NAME, fmt, __VA_ARGS__) #define debugf(fmt, ...) n_debugf(LOG_NAME, fmt, __VA_ARGS__) - -const char *const_byte_str(uint8_t b); - -#endif /* _LIBMISC_LOG_H_ */ +#endif |