Skip to content

Commit

Permalink
Merge pull request #75 from FundingCircle/tags-in-strings
Browse files Browse the repository at this point in the history
Concatenate tags into String instead of Array to allow Graylog search
  • Loading branch information
timstott authored Aug 16, 2016
2 parents daa9a2f + 7db9722 commit f9fd37d
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Loga.logger.info('Hello World')
"level": 6,
"_service.name": "marketplace",
"_service.version": "v1.0.0",
"_tags": []
"_tags": ""
}
```

Expand Down
2 changes: 1 addition & 1 deletion lib/loga/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def loga_additional_fields
name: @service_name,
version: @service_version,
},
tags: current_tags,
tags: current_tags.join(' '),
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/loga/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Loga
VERSION = '1.1.1'.freeze
VERSION = '1.2.1'.freeze
end
2 changes: 1 addition & 1 deletion spec/fixtures/rails32/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Application < Rails::Application
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
# config.active_record.whitelist_attributes = true
config.log_tags = [:uuid]
config.log_tags = [ :uuid, 'TEST_TAG' ]
config.loga.configure do |loga|
loga.service_name = 'hello_world_app'
loga.service_version = '1.0'
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/rails40/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.log_tags = [:uuid]
config.log_tags = [ :uuid, 'TEST_TAG' ]
config.loga.configure do |loga|
loga.service_name = 'hello_world_app'
loga.service_version = '1.0'
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/sinatra_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
set :show_exceptions, false

use Loga::Rack::RequestId
use Loga::Rack::Logger, Loga.logger, [:uuid]
use Loga::Rack::Logger, Loga.logger, [:uuid, 'TEST_TAG']

error do
status 500
Expand Down
10 changes: 5 additions & 5 deletions spec/support/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'_request.status' => 200,
'_request.request_id' => '471a34dc',
'_request.duration' => 0,
'_tags' => ['471a34dc'],
'_tags' => '471a34dc TEST_TAG',
)
end
end
Expand Down Expand Up @@ -52,7 +52,7 @@
'_request.status' => 200,
'_request.request_id' => '471a34dc',
'_request.duration' => 0,
'_tags' => ['471a34dc'],
'_tags' => '471a34dc TEST_TAG',
)
end

Expand Down Expand Up @@ -83,7 +83,7 @@
'_request.status' => 302,
'_request.request_id' => '471a34dc',
'_request.duration' => 0,
'_tags' => ['471a34dc'],
'_tags' => '471a34dc TEST_TAG',
)
end
end
Expand Down Expand Up @@ -114,7 +114,7 @@
'_exception.klass' => 'NoMethodError',
'_exception.message' => "undefined method `name' for nil:NilClass",
'_exception.backtrace' => be_a(String),
'_tags' => ['471a34dc'],
'_tags' => '471a34dc TEST_TAG',
)
end
end
Expand All @@ -140,7 +140,7 @@
'_request.status' => 404,
'_request.request_id' => '471a34dc',
'_request.duration' => 0,
'_tags' => ['471a34dc'],
'_tags' => '471a34dc TEST_TAG',
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/loga/formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
it 'includes Loga additional fields' do
expect(json).to include('_service.name' => service_name,
'_service.version' => service_version,
'_tags' => [])
'_tags' => '')
end

it 'outputs the timestamp in seconds since UNIX epoch' do
Expand Down

0 comments on commit f9fd37d

Please sign in to comment.