Skip to content

Commit

Permalink
feat: configuration file for defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
bomgar committed Nov 28, 2023
1 parent 8a1c87f commit 7d234e7
Show file tree
Hide file tree
Showing 12 changed files with 358 additions and 93 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*.rs]
indent_style = space
indent_size = 2
max_line_length = 160

160 changes: 159 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ mlua = { version = "0.9", features = ["lua54", "vendored"] }
lazy_static = "1.4.0"
handlebars = "4"
clap_complete = "4"
serde = { version = "1", features = ["derive"] }
toml = "0.8"
dirs = "5"

[dependencies.clap]
version = "4"
Expand Down
5 changes: 5 additions & 0 deletions default_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message_keys = ["short_message", "msg", "message"]
time_keys = ["timestamp", "time", "@timestamp"]
level_keys = ["level", "severity", "log.level", "loglevel"]
main_line_format = "{{bold(fixed_size 19 fblog_timestamp)}} {{level_style (uppercase (fixed_size 5 fblog_level))}}:{{bold(color_rgb 138 43 226 fblog_prefix)}} {{fblog_message}}"
additional_value_format = "{{bold (color_rgb 150 150 150 (fixed_size 25 key))}}: {{value}}"
3 changes: 0 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::substitution::Substitution;
use crate::template;
use clap::{crate_version, value_parser, ArgAction, ValueHint};
use clap::{Arg, Command};
use clap_complete::Shell;
Expand Down Expand Up @@ -107,14 +106,12 @@ pub fn app() -> Command {
Arg::new("main-line-format")
.long("main-line-format")
.num_args(1)
.default_value(template::DEFAULT_MAIN_LINE_FORMAT)
.help("Formats the main fblog output. All log values can be used. fblog provides sanitized variables starting with `fblog_`."),
)
.arg(
Arg::new("additional-value-format")
.long("additional-value-format")
.num_args(1)
.default_value(template::DEFAULT_ADDITIONAL_VALUE_FORMAT)
.help("Formats the additional value fblog output."),
)
.arg(
Expand Down
Loading

0 comments on commit 7d234e7

Please sign in to comment.