Skip to content

Commit

Permalink
Fix Crystal 0.35 compatibility (crystal-lang#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian J. Cardiff committed May 15, 2020
1 parent fc3108f commit 47d4ee2
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/logger.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,32 @@ module Shards
Log = ::Log.for(self)

def self.set_warning_log_level
Log.level = ::Log::Severity::Warning
{% if compare_versions(Crystal::VERSION, "0.35.0-0") > 0 %}
Log.level = ::Log::Severity::Warn
{% else %}
Log.level = ::Log::Severity::Warning
{% end %}
end

def self.set_debug_log_level
Log.level = ::Log::Severity::Debug
end

LOGGER_COLORS = {
::Log::Severity::Error => :red,
::Log::Severity::Warning => :yellow,
::Log::Severity::Info => :green,
::Log::Severity::Debug => :light_gray,
}
{% if compare_versions(Crystal::VERSION, "0.35.0-0") > 0 %}
LOGGER_COLORS = {
::Log::Severity::Error => :red,
::Log::Severity::Warn => :yellow,
::Log::Severity::Info => :green,
::Log::Severity::Debug => :light_gray,
}
{% else %}
LOGGER_COLORS = {
::Log::Severity::Error => :red,
::Log::Severity::Warning => :yellow,
::Log::Severity::Info => :green,
::Log::Severity::Debug => :light_gray,
}
{% end %}

FORMATTER = ::Log::Formatter.new do |entry, io|
message = entry.message
Expand Down

0 comments on commit 47d4ee2

Please sign in to comment.