Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Remove event namespace (#73)
Browse files Browse the repository at this point in the history
* Remove event namespace

* Use 2.0.1
  • Loading branch information
binarylogic committed Apr 24, 2017
1 parent 9b2d24b commit 1905858
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/timber/events/controller_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:controller_call => to_hash}}
{:controller_call => to_hash}
end

def message
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/events/exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:exception => to_hash}}
{:exception => to_hash}
end

def message
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/events/http_client_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:http_client_request => to_hash}}
{:http_client_request => to_hash}
end

def message
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/events/http_client_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:http_client_response => to_hash}}
{:http_client_response => to_hash}
end

def message
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/events/http_server_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:http_server_request => to_hash}}
{:http_server_request => to_hash}
end

def message
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/events/http_server_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:http_server_response => to_hash}}
{:http_server_response => to_hash}
end

def message
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/events/sql_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:sql_query => to_hash}}
{:sql_query => to_hash}
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/events/template_render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def to_hash
alias to_h to_hash

def as_json(_options = {})
{:server_side_app => {:template_render => to_hash}}
{:template_render => to_hash}
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/timber/log_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Timber
# `Logger` and the log device that you set it up with.
class LogEntry #:nodoc:
DT_PRECISION = 6.freeze
SCHEMA = "https://raw.githubusercontent.com/timberio/log-event-json-schema/1.2.21/schema.json".freeze
SCHEMA = "https://raw.githubusercontent.com/timberio/log-event-json-schema/2.0.1/schema.json".freeze

attr_reader :context_snapshot, :event, :level, :message, :progname, :tags, :time, :time_ms

Expand Down
2 changes: 1 addition & 1 deletion lib/timber/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Timber
VERSION = "2.0.17"
VERSION = "2.0.18"
end
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def method_for_action(action_name)
lines = clean_lines(io.string.split("\n"))
expect(lines.length).to eq(3)
expect(lines[1]).to start_with('Processing by LogSubscriberController#index as HTML\n Parameters: {"query"=>"value"} @metadata {"level":"info","dt":"2016-09-01T12:00:00.000000Z"')
expect(lines[1]).to include('"event":{"server_side_app":{"controller_call":{"controller":"LogSubscriberController","action":"index","params_json":"{\"query\":\"value\"}"}}}')
expect(lines[1]).to include('"event":{"controller_call":{"controller":"LogSubscriberController","action":"index","params_json":"{\"query\":\"value\"}"}}')
end

# Remove blank lines since Rails does this to space out requests in the logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def method_for_action(action_name)
lines = clean_lines(io.string.split("\n"))
expect(lines.length).to eq(3)
expect(lines[2]).to start_with('RuntimeError (boom) @metadata {"level":"fatal",')
expect(lines[2]).to include("\"event\":{\"server_side_app\":{\"exception\":{\"name\":\"RuntimeError\",\"message\":\"boom\",\"backtrace\":[")
expect(lines[2]).to include("\"event\":{\"exception\":{\"name\":\"RuntimeError\",\"message\":\"boom\",\"backtrace\":[")
end

# Remove blank lines since Rails does this to space out requests in the logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def method_for_action(action_name)
dispatch_rails_request("/action_view_log_subscriber")
lines = clean_lines(io.string.split("\n"))
expect(lines[2].strip).to start_with("Rendered spec/support/rails/templates/template.html (0.0ms) @metadata {\"level\":\"info\"")
expect(lines[2]).to include("\"event\":{\"server_side_app\":{\"template_render\":{\"name\":\"spec/support/rails/templates/template.html\",\"time_ms\":0.0}}},")
expect(lines[2]).to include("\"event\":{\"template_render\":{\"name\":\"spec/support/rails/templates/template.html\",\"time_ms\":0.0}},")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
expect(string).to include("select * from users")
expect(string).to include("@metadata")
expect(string).to include("\"level\":\"debug\"")
expect(string).to include("\"event\":{\"server_side_app\":{\"sql_query\"")
expect(string).to include("\"event\":{\"sql_query\"")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/timber/logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
message = Timber::Events::SQLQuery.new(sql: "select * from users", time_ms: 56, message: "select * from users")
logger.info(message)
expect(io.string).to start_with("select * from users @metadata {\"level\":\"info\",\"dt\":\"2016-09-01T12:00:00.000000Z\",")
expect(io.string).to include("\"event\":{\"server_side_app\":{\"sql_query\":{\"sql\":\"select * from users\",\"time_ms\":56.0}}}")
expect(io.string).to include("\"event\":{\"sql_query\":{\"sql\":\"select * from users\",\"time_ms\":56.0}}")
end

it "should allow :time_ms" do
Expand Down

0 comments on commit 1905858

Please sign in to comment.