feat(core): add OpenCV-style logging facade (#80)#87
Open
kalwalt wants to merge 5 commits into
Open
Conversation
Add a new core::logging module mirroring cv::utils::logging, built on the existing log crate facade. Provides: - LogLevel enum (Silent/Fatal/Error/Warning/Info/Debug/Verbose) with From conversions to/from log::LevelFilter and log::Level - set_log_level/get_log_level with return-previous semantics - tags submodule with per-subsystem constants (PURECV, CORE, IMGPROC, FEATURES2D, CALIB3D, VIDEO) - Level macros: cv_log_fatal/error/warning/info/debug/verbose - Once-per-call-site macros: cv_log_once_error/warning/info/debug (AtomicBool-based, no_std-friendly) - Conditional macros: cv_log_if_error/warning/info/debug Breaking change: set_log_level/get_log_level now use LogLevel instead of log::LevelFilter (pre-1.0, zero callers in codebase). Closes #80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
core::loggingmodule mirroring OpenCV'scv::utils::logging, built on the existinglogcrate facade.Closes #80
What's included
LogLevelenum7 variants:
Silent,Fatal,Error,Warning,Info,Debug,Verbosewith bidirectional conversions to/fromlog::LevelFilterandlog::Level.Functions
set_log_level(LogLevel) -> LogLevel— returns previous level (OpenCV semantics)get_log_level() -> LogLeveltagssubmodulePer-subsystem constants:
PURECV,CORE,IMGPROC,FEATURES2D,CALIB3D,VIDEOMacros (all
#[macro_export])cv_log_fatal!,cv_log_error!,cv_log_warning!,cv_log_info!,cv_log_debug!,cv_log_verbose!cv_log_once_error!,cv_log_once_warning!,cv_log_once_info!,cv_log_once_debug!cv_log_if_error!,cv_log_if_warning!,cv_log_if_info!,cv_log_if_debug!Example usage
Files changed (6)
src/core/logging.rssrc/core.rssrc/core/utils.rssrc/lib.rsLogLevel+tagsto preludesrc/version.rslog::info!tocv_log_info!src/core/tests.rsBreaking change
set_log_level/get_log_levelnow take/returnLogLevelinstead oflog::LevelFilter. These functions had zero callers in the entire codebase and the crate is pre-1.0 (0.6.1).Verification