Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Dexter for the logger #300

Merged
merged 1 commit into from
Feb 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/web_app_skeleton/config/logger.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,30 @@ logger =
# Logs to `tmp/test.log` so you can see what's happening without having
# a bunch of log output in your specs results.
FileUtils.mkdir("tmp")
Lucky::Logger.new(
Dexter::Logger.new(
io: File.new("tmp/test.log", mode: "w"),
level: Logger::Severity::DEBUG,
log_formatter: Lucky::PrettyLogFormatter.new
log_formatter: Lucky::PrettyLogFormatter
)
elsif Lucky::Env.production?
# This sets the log formatter to JSON so you can parse the logs with
# services like Logentries or Logstash.
#
# If you want logs like in develpoment use `Lucky::PrettyLogFormatter`.
Lucky::Logger.new(
Dexter::Logger.new(
io: STDOUT,
level: Logger::Severity::INFO,
log_formatter: Lucky::JsonLogFormatter.new
log_formatter: Dexter::Formatters::JsonLogFormatter
)
else
# For development, log everything to STDOUT with the pretty formatter
Lucky::Logger.new(
# For development, log everything to STDOUT with the pretty formatter.
Dexter::Logger.new(
io: STDOUT,
level: Logger::Severity::DEBUG,
log_formatter: Lucky::PrettyLogFormatter.new
log_formatter: Lucky::PrettyLogFormatter
)
end

Lucky.configure do |settings|
settings.logger = logger
end

Lucky::LogHandler.configure do |settings|
settings.logger = logger
end