summaryrefslogtreecommitdiffstats
path: root/lib/core/libimagrt/src/logger.rs
AgeCommit message (Collapse)Author
2020-05-31handlebars: 2 -> 3Matthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-04-26Clippy Fix: let_underscore_lockMatthias Beyer
Use _variable instead of _ as a variable name for lock. Expl.: https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_lock Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-03-08Replace failure with anyhow in complete codebaseMatthias Beyer
This patch was scripted with sed -i 's/use failure::Error/use anyhow::Error/' $(rg "use failure::Error" -l) sed -i 's/use failure::Fallible as /use anyhow::/' $(rg "use failure::Fallible" -l) sed -i 's/failure/anyhow/' $(rg "failure *=" -l) sed -i 's/format_err!/anyhow!/' $(rg "format_err!" -l) sed -i 's/use failure::ResultExt/use anyhow::Context/' $(rg "use failure::ResultExt" -l) sed -i 's/err_msg/anyhow!/' $(rg "use failure::err_msg" -l) sed -i 's/^anyhow\ *=.*$/anyhow = "1"/' $(rg "anyhow * =" -l) sed -i 's/^anyhow_derive.*//' $(rg "anyhow_derive" -l) sed -i 's/extern crate failure/extern crate anyhow/' $(rg "extern crate failure" -l) sed -i 's/.*extern crate anyhow_derive.*//' $(rg "anyhow_derive" -l) Some manual changes were added as well, so this patch was not completely scripted, but mostly. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-02-28Remove module-based loggingMatthias Beyer
This patch removes the module-based logging mechanism. This mechanism was introduced so that the configuration file is able to define which imag module logs what. This was a fine-granular setting, but most users won't actually touch it. It was more of a debugging-thing for developers. I rarely used it during development and it only introduced more headaches. It also was not updated (as in the configuration file missed a few modules, others where not removed despite the module did not exist anymore). All in all, it was rather unmaintained and just "too much". Thus, remove this thing completely. Developers know how to use grep. This also automatically fixes bugs where `imag --debug command` did not output any debugging log, but was expected to. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-02-28Fix: If global loglevel allowes record to be logged, log itMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-01Update copyright years to 2015-2020Matthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28[No-auto] lib/core/rt: Fix Clippy warningsflip1995
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-08-28[Auto] lib/core/rt: Fix Clippy warningsflip1995
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-07-26Refactor: Do not provide functions for these identifiersMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-30Rewrite to use derive macroMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-30Add comment why we do thisMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-30Remove boilerplate by enabling serde in "log" dependencyMatthias Beyer
This patch adds the "serde" feature to the "log" dependency, so we can deserialize logging levels directly into "log" types. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-30Rewrite logging config deserializationMatthias Beyer
This patch rewrites the logging config deserialization. It removes the manual traversing of the config toml structure and replaces it with types which implement `Deserialize`, which is way more convenient and easy to read (and extend). Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18Add more context in error messagesMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-05-18Run 'cargo fix' for rust-2018Matthias Beyer
With this patch we move the codebase to Rust-2018. The diff was generated by executing cargo fix --all --all-features --edition on the codebase. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-19Add output about logger settings in logging setupMatthias Beyer
This way we can get trace-level information about the logger itself when it is generated. Because from time to time we might want to have a look at that. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-15Remove unused variableMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-11Simplify implementationMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-02-05Remove log-destination-override featuresMatthias Beyer
This removes the feature to be able to override log destinations from the commandline. This feature is removed because the --override-config feature from the runtime already contains this functionality. It is a little more complex to use, though this is a feature hardly used at all, so I rather go for less code (less complexity) here than feature bloat. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-01-03Update copyright yearsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06Remove call to format_err!(), use err_msg() insteadMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-11-06Remove repetitive code by abstracting itMatthias Beyer
With this patch, the log level aggregation is abstracted away by using zero sized types and a macro to implement the whole thing. This does not alter functionality, but makes the code more readable. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-30libimagrt: Move from error-chain to failureMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-26Fix: `--debug` on CLI should enable logging and override itMatthias Beyer
When specifying the `--debug` flag on the commandline, logging was not enabled. That was because the config file parsing did not consider the args. Now, if `--debug` is passed on the CLI, logging is enabled for all modules and level is set to `debug` for all modules. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-10-11Add detailed comments on how the logger worksMatthias Beyer
2018-10-06Remove handlebars exception in log implementationMatthias Beyer
The issue was that the handlebars implementation logs as well and if we use handlebars in the logger implementation that causes recursion which crashes the program. With handlebars 1.0.5, there is a feature[0] to disable logging in handlebars (compiletime) which we use with this patch. The exception-checking in the log implementation can be removed therefore. [0]: https://github.com/sunng87/handlebars-rust/pull/236#issuecomment-427014611 Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2018-04-14Fix log level setting in runtimeMatthias Beyer
Do not immediately set log level to Level::Info if argument is present, but check value, too.
2018-02-07Update dates in license headerMatthias Beyer
And add missing header in one file
2018-01-15Adapt libimagrt for new log setupMatthias Beyer
2018-01-13libimagrt: Replace read with typed readMatthias Beyer
2018-01-05Refactor toml destructure matching.Matthias Beyer
Use accessor functionality and function chaining now.
2017-10-31Simplify matchingMatthias Beyer
2017-10-31Use ? operator instead of try!() macroMatthias Beyer
2017-10-31Rewrite configuration providing in runtimeMatthias Beyer
Before the configuration object (the raw TOML object) was provided via a wrapper object `Configuration`. This was ugly and not very nice to use. Now, we only have the `toml::Value` object we lend out from `Runtime::config()`. The changes included libimagrt internal rewrites, which are not visible to the user. Anyways, this change changes the API for config-fetching from the runtime, so fixes for all other crates may follow. The changes also removed the support for reading the "editor" setting from the configuration file, which was not used anyways (in the example imagrc.toml file). The CLI-reading and ENV-reading are still supported, though.
2017-10-16Merge pull request #1149 from ↵Matthias Beyer
matthiasbeyer/libimagrt/remove-logging-format-overrides Remove override functionality for logging formats
2017-10-16Remove override functionality for logging formatsMatthias Beyer
2017-10-15Fix: Overide logging with --debugMatthias Beyer
Formerly, the --debug flag was ignores. This change overrides the logging with the CLI specified logging if it was provided. If --debug was provided, the logging is set to debugging, if --verbose was provided info logging is used.
2017-10-12Add helper functions to register all helpersMatthias Beyer
2017-10-12Move handlebars custom helpers to libimaginteractionMatthias Beyer
2017-10-08Add multi-destination logging to loggerMatthias Beyer
The logger was not able to handle multiple destinations before. Now it is possible for the logger. The file must be held behind an Arc<Mutex<_>> so we can use the logging from multiple threads but also because we need to borrow mutably, so that bit changes whith this commit.
2017-09-20Register the no-escape escape functionality in handlebarsMatthias Beyer
Before, handlebars automatically applied html escaping, which resulted in <>'& beeing escaped. But we don't need to escape for terminal output.
2017-09-09Add param to ConfigTypeErrorMatthias Beyer
2017-09-09Remove ConfigReadError because ::toml_query::error::Error is now linked inMatthias Beyer
2017-09-09Remove TomlReadError by linking in ::toml_query::error::ErrorMatthias Beyer
2017-09-09Remove TemplateStringRegistrationError by linking in handlebars error typeMatthias Beyer
2017-09-04Merge branch 'master' into libimagerror/integrationMatthias Beyer
This merge solved a _LOT_ of conflicts and was a rather complicated one, as parts of the conflict-resolution involved rewriting of half the stuff. This merge commit fixes all the things so a `cargo check --all` succeeds, but I did not yet check whether tests run without failure.
2017-09-03Add more helpersMatthias Beyer
2017-09-03Fix recursion problemMatthias Beyer
2017-09-03Light code cleanupMatthias Beyer
2017-09-03Fix aggregationMatthias Beyer