From 169848a5ab1d7d20d333ee010349f76bf5005b44 Mon Sep 17 00:00:00 2001 From: Arnaud Henry Date: Fri, 16 Jul 2021 15:14:37 +0100 Subject: [PATCH] Add FAQ entry for changing the date format --- docs/make.jl | 1 + docs/src/faq/change-date-format.md | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 docs/src/faq/change-date-format.md diff --git a/docs/make.jl b/docs/make.jl index 88fc2dc..229b9b4 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -24,6 +24,7 @@ makedocs( "FAQ" => Any[ "faq/another-logging-lib.md", "faq/change-colors.md", + "faq/change-date-format.md", "faq/config-recipes.md", "faq/logging-to-syslog.md", "faq/json-formatting.md", diff --git a/docs/src/faq/change-date-format.md b/docs/src/faq/change-date-format.md new file mode 100644 index 0000000..9692d93 --- /dev/null +++ b/docs/src/faq/change-date-format.md @@ -0,0 +1,9 @@ +# [Changing date format?](@id change_date_format) + +The default date format is `yyyy-mm-dd HH:MM:SS`. +To change that, for example if you want to display milliseconds, you'll have to change the `Formatter` like so: + +```julia +# Changes the formatter of the console handler of the root logger +gethandlers(getlogger())["console"].fmt = DefaultFormatter("[{date} | {name} | {level}]: {msg}"; date_fmt_string="yyyy-mm-dd HH:MM:SS.sss") +```