Commit 8dee7b96fd6eaea54400aaf317f72aac9b323b58

Authored by Simon Glass
Committed by Bin Meng
1 parent f0b05c95e3

log: Add documentation for convenience functions

The log_debug(), etc. function are documented only in the header file at
present. Add a section to README.log also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Showing 1 changed file with 26 additions and 10 deletions Side-by-side Diff

... ... @@ -69,6 +69,32 @@
69 69 The above have SPL versions also, e.g. CONFIG_SPL_MAX_LOG_LEVEL.
70 70  
71 71  
  72 +Convenience functions
  73 +---------------------
  74 +
  75 +A number of convenience functions are available to shorten the code needed
  76 +for logging:
  77 +
  78 + log_err(_fmt...)
  79 + log_warning(_fmt...)
  80 + log_notice(_fmt...)
  81 + log_info(_fmt...)
  82 + log_debug(_fmt...)
  83 + log_content(_fmt...)
  84 + log_io(_fmt...)
  85 +
  86 +With these the log level is implicit in the name. The category is set by
  87 +LOG_CATEGORY, which you can only define once per file, above all #includes:
  88 +
  89 + #define LOG_CATEGORY LOGC_ALLOC
  90 +
  91 +or
  92 +
  93 + #define LOG_CATEGORY UCLASS_SPI
  94 +
  95 +Remember that all uclasses IDs are log categories too.
  96 +
  97 +
72 98 Log commands
73 99 ------------
74 100  
... ... @@ -186,16 +212,6 @@
186 212 log_board(level, format_string, ...) - category LOGC_BOARD
187 213 log_core(level, format_string, ...) - category LOGC_CORE
188 214 log_dt(level, format_string, ...) - category LOGC_DT
189   -
190   -Convenience functions to support a category defined for a single file, for
191   -example:
192   -
193   - #define LOG_CATEGORY UCLASS_USB
194   -
195   -all of these can use LOG_CATEGORY as the category, and a log level
196   -corresponding to the function name:
197   -
198   - logc(level, format_string, ...)
199 215  
200 216 More logging destinations:
201 217