File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 318
318
319
319
global_logger(transformer_logger)
320
320
```
321
+
322
+ ## Add timestamp to all logging
323
+
324
+ ``` julia
325
+ using Logging, LoggingExtras, Dates
326
+
327
+ const date_format = " yyyy-mm-dd HH:MM:SS"
328
+
329
+ timestamp_logger (logger) = TransformerLogger (logger) do log
330
+ merge (log, (; message = " $(Dates. format (now (), date_format)) $(log. message) " ))
331
+ end
332
+
333
+ ConsoleLogger (stdout , Logging. Debug) |> timestamp_logger |> global_logger
334
+ ```
335
+
336
+ This will produce output similar to:
337
+ ``` julia
338
+ [ Info: 2019 - 09 - 20 17 : 43 : 54 / es/ update 200
339
+ ┌ Debug: 2019 - 09 - 20 18 : 03 : 25 Recompiling stale cache file / . julia/ compiled/ v1.2 / TranslationsController. ji for TranslationsController [top- level]
340
+ └ @ Base loading. jl: 1240
341
+ ┌ Error: 2019 - 09 - 20 17 : 43 : 54 ErrorException (" SearchLight validation error(s) for Translations.Translation" )
342
+ └ @ TranslationsController ~ / Dropbox/ Projects/ LiteCMS/ app/ resources/ translations/ TranslationsController. jl: 69
343
+ ```
You can’t perform that action at this time.
0 commit comments