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") +```