- 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
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.
eg.
set_output_log_level(LOG_PREFIX_WARN);
Just the log where log level is LOG_LEVEL_WARN or LOG_LEVEL_ERROR is output.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
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)