mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
Fix incorrect severity field.
This commit is contained in:
parent
bf82b34f10
commit
d9602fe729
@ -3,7 +3,8 @@ require 'json'
|
|||||||
class UnicornJSONLogFormatter < Logger::Formatter
|
class UnicornJSONLogFormatter < Logger::Formatter
|
||||||
def call(severity, datetime, progname, message)
|
def call(severity, datetime, progname, message)
|
||||||
default = {
|
default = {
|
||||||
severity: severity,
|
severity: "Logger::Severity::#{severity}".constantize,
|
||||||
|
severity_name: severity,
|
||||||
datetime: DateTime.parse(datetime.to_s).to_s,
|
datetime: DateTime.parse(datetime.to_s).to_s,
|
||||||
progname: progname || '',
|
progname: progname || '',
|
||||||
pid: $$,
|
pid: $$,
|
||||||
|
@ -11,7 +11,7 @@ RSpec.describe UnicornJSONLogFormatter do
|
|||||||
error = e
|
error = e
|
||||||
|
|
||||||
output = described_class.new.call(
|
output = described_class.new.call(
|
||||||
'INFO',
|
'ERROR',
|
||||||
Time.zone.now,
|
Time.zone.now,
|
||||||
'',
|
'',
|
||||||
e
|
e
|
||||||
@ -20,7 +20,8 @@ RSpec.describe UnicornJSONLogFormatter do
|
|||||||
|
|
||||||
output = JSON.parse(output)
|
output = JSON.parse(output)
|
||||||
|
|
||||||
expect(output["severity"]).to eq('INFO')
|
expect(output["severity"]).to eq(3)
|
||||||
|
expect(output["severity_name"]).to eq("ERROR")
|
||||||
expect(output["datetime"]).to be_present
|
expect(output["datetime"]).to be_present
|
||||||
expect(output["progname"]).to eq('')
|
expect(output["progname"]).to eq('')
|
||||||
expect(output["pid"]).to be_present
|
expect(output["pid"]).to be_present
|
||||||
|
Loading…
Reference in New Issue
Block a user