log <- logger(appenders = console_appender(layout = json_log_layout()))
info(log, "Log starting.")
warn(log, "This is a warning!")
error(log, "This is an error.")
debug(log, "This won't show up.")
## {"message":"Log starting.","level":"INFO","time":"2022-12-03T16:35:23Z"}
## {"message":"This is a warning!","level":"WARN","time":"2022-12-03T16:35:23Z"}
## {"message":"This is an error.","level":"ERROR","time":"2022-12-03T16:35:23Z"}
info(log, message = "Log starting.", my_var = 2)
## {"message":"Log starting.","my_var":2,"level":"INFO","time":"2022-12-03T16:37:19Z"}
log <- logger(appenders = console_appender(layout = logfmt_log_layout()))
info(log, message = "Log starting.", my_var = 2)
## level=INFO ts=2022-12-03T16:40:13Z message="Log starting." my_var=2