• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Uchida - 2008-12-31
Last edited by speachy - 2020-07-03

FS#9734 - logf add log level

logf() is used in order to output the log of the use which differs “info”, “worning” or “error”.

Log level is added to logf() by applying the patch, it becomes the way which understands it is some kind of log.

debug log:

logf(LOG_LEVEL_DEBUG, ...)
Simply:  debugf(...)

info log:

logf(LOG_LEVEL_INFO, ...)
Simply: logf(...)

warning log:

logf(LOG_LEVEL_WARN, ...)
Simply:  warnf(...)

error log:

logf(LOG_LEVEL_ERROR, ...)
Simply:  errorf(...)

In addition, it added function set_output_log_level(int level), it tried to be able to set the level of the log which is output.



Just the log where log level is LOG_LEVEL_WARN or LOG_LEVEL_ERROR is output.

Closed by  speachy
2020-07-03 03:43
Reason for closing:  Out of Date

I was thinking of implementing the same thing, but apparently you're faster :)

I think your implementation is quite good, apart from one thing: you add the logf ouput level prefix directly to the to-be-logged string. I wouldn't do that, but use the MAX_LOGF_ENTRY'ed byte at every line to indicate what the output level is (like setting bit 7 means Warning, bit 6 means Error, etc).

That way you save some space + there's an easier and faster way to filter out lower level log messages (e.g. only display messages with bit X set).

Also, why do you use rb→warnf(), rb→errorf() etc when you don't add them to the plugin struct? (I wouldn't add separate function calls either, just extend logf(const char *fmt, …) to logf(int level, const char *fmt, …) (like you did) and use macro's to do WARNF(), ERRORF() etc)


Available keyboard shortcuts


Task Details

Task Editing