1
0
Fork 0

Tweak cosmic text and module logging settings

In release builds the cosmic text messages are now suppressed, and in
debug builds the module is always shown even for error, warning, and
info messages.
This commit is contained in:
Robbert van der Helm 2023-03-21 20:31:45 +01:00
parent 89dd0bf461
commit 2de1fd563b
4 changed files with 22 additions and 7 deletions

View file

@ -14,6 +14,11 @@ state is to list breaking changes.
### Changed ### Changed
- The logger now always shows the module in debug builds to make it easier to
know where logging messages are sent from. Previously this was only done for
the debug and trace message levels.
- The logger now filters out the `Mapped XXXX font faces in YYYms.` messages
from cosmic text in release builds as this is unnecessary noise for end users.
- `nih_plug_vizia`: `ParamButton`'s active color was made much lighter to make - `nih_plug_vizia`: `ParamButton`'s active color was made much lighter to make
the text more readable, and the hover state has been fixed. the text more readable, and the hover state has been fixed.

4
Cargo.lock generated
View file

@ -2430,9 +2430,9 @@ dependencies = [
[[package]] [[package]]
name = "nih_log" name = "nih_log"
version = "0.2.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "016c1e345f1130730057d9b5381f423a36393b21c4f38f3ed05638448b6a5c48" checksum = "f1d8a01d9663de15dbec9eaa9b7c261588e615ec204797b63039a2b0f30680fd"
dependencies = [ dependencies = [
"atty", "atty",
"log", "log",

View file

@ -85,7 +85,7 @@ crossbeam = "0.8"
lazy_static = "1.4" lazy_static = "1.4"
log = { version = "0.4", features = ["std", "release_max_level_info"] } log = { version = "0.4", features = ["std", "release_max_level_info"] }
midi-consts = "0.1" midi-consts = "0.1"
nih_log = "0.2.0" nih_log = "0.3.0"
parking_lot = "0.12" parking_lot = "0.12"
raw-window-handle = "0.4" raw-window-handle = "0.4"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -108,11 +108,21 @@ pub fn setup_logger() {
log::LevelFilter::Info log::LevelFilter::Info
}; };
let logger_set = nih_log::LoggerBuilder::new(log_level) let logger_builder = nih_log::LoggerBuilder::new(log_level)
.filter_module("cosmic_text::buffer") .filter_module("cosmic_text::buffer")
.filter_module("cosmic_text::shape") .filter_module("cosmic_text::shape");
.build_global()
.is_ok(); // Always show the module in debug builds, makes it clearer where messages are coming from and
// it helps set up filters
#[cfg(debug_assertions)]
let logger_builder = logger_builder.always_show_module_path();
// In release builds there are some more logging messages from libraries that are not relevant
// to the end user that can be filtered out
#[cfg(not(debug_assertions))]
let logger_builder = logger_builder.filter_module("cosmic_text::font::system::std");
let logger_set = logger_builder.build_global().is_ok();
if logger_set { if logger_set {
log_panics(); log_panics();
} }