Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log level per compilation unit #69

Merged
merged 5 commits into from
Feb 17, 2023
Merged

Conversation

isherman
Copy link
Contributor

@isherman isherman commented Feb 16, 2023

  • LOG_INFO, LOG_WARN, LOG_ERROR, LOG_CRITICAL macros are always defined and compiled.
  • Log level output is toggled at runtime:
    • Default runtime log level is LogLevel::warning
    • One would use e.g. defaultLogger().setLogLevel(LogLevel::info); to enable lower log level - globally for all files at runtime.

If one need to enable noisy logs per compilation unit, this shall be done using the following mechanism:

#define FARM_LOG_LEVEL FARM_LOG_LEVEL_DEBUG
#include "farm_ng/core/logging/trace_debug_log.h"

Enabling such noisy log levels globally (and such macros in header files) is not supported. The rationale is that such noisy logging is not very helpful (too low signal to noise) and will most likely hurt performance to a degree that it makes debug execution too slow.

@strasdat strasdat force-pushed the log-level-per-computation-unit-2 branch from 03586b7 to ea337e2 Compare February 17, 2023 02:15
INFO higher levels always compiled, there is still a run-time level which defaults to warn
@strasdat strasdat force-pushed the log-level-per-computation-unit-2 branch from ea337e2 to 876299e Compare February 17, 2023 02:28
@isherman isherman changed the title WIP: Log level per computation unit, v2 Log level per compilation unit Feb 17, 2023
@isherman isherman merged commit aaea5f6 into main Feb 17, 2023
@isherman isherman deleted the log-level-per-computation-unit-2 branch February 17, 2023 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants