Skip to content

Commit

Permalink
Added more convenience configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Nov 26, 2023
1 parent 061f4f0 commit 5363ae1
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
17 changes: 17 additions & 0 deletions priv/config/info.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{kernel, [
{logger, [
{handler, default, logger_std_h,
#{level => info,
formatter => {logjam, #{colored => true,
time_designator => $\s,
time_offset => "",
time_unit => second,
strip_tz => true,
level_capitalize => true}}
}
}
]},
{logger_level, info}
]}
].
17 changes: 17 additions & 0 deletions priv/config/notice.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{kernel, [
{logger, [
{handler, default, logger_std_h,
#{level => notice,
formatter => {logjam, #{colored => true,
time_designator => $\s,
time_offset => "",
time_unit => second,
strip_tz => true,
level_capitalize => true}}
}
}
]},
{logger_level, notice}
]}
].
2 changes: 1 addition & 1 deletion priv/config/prod.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
time_designator => $\s,
time_offset => "",
time_unit => second,
strip_tz => true,
strip_tz => false,
level_capitalize => true}}
}
}
Expand Down
4 changes: 3 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
]},
{demo, [
compile,
{lfe, 'run', "-m scripts/demo.lfe -- ./priv/config/dev.config"}
%%{lfe, 'run', "-m scripts/demo.lfe -- ./priv/config/dev.config"},
%%{lfe, 'run', "-m scripts/demo.lfe -- ./priv/config/prod.config"},
{lfe, 'run', "-m scripts/demo.lfe -- ./priv/config/sys.config"}
]},
{publish, [
clean,
Expand Down
2 changes: 1 addition & 1 deletion src/logjam.app.src
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{application, logjam,
[{description, "A custom formatter for the logger application "
"with LFE logging macros and human-readable output"},
{vsn, "1.2.2"},
{vsn, "1.2.3"},
{registered, []},
{applications,
[kernel,
Expand Down
8 changes: 8 additions & 0 deletions src/logjam.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
(get-config 1)
(set-config 1)
(set-dev-config 0)
(set-info-config 0)
(set-notice-config 0)
(set-prod-config 0))
(export-macro
log debug info notice warn warning error critical alert emergency))
Expand Down Expand Up @@ -59,6 +61,12 @@
(defun set-dev-config ()
(set-config `#(path ,(get-config 'dev))))

(defun set-info-config ()
(set-config `#(path ,(get-config 'info))))

(defun set-notice-config ()
(set-config `#(path ,(get-config 'notice))))

(defun set-prod-config ()
(set-config `#(path ,(get-config 'prod))))

Expand Down

0 comments on commit 5363ae1

Please sign in to comment.