Skip to content
Browse files

use multi_json

  • Loading branch information...
1 parent f7a221b commit 189059aba111d0edc6791211ba1aad74ee1fd9d5 @freeformz committed
Showing with 10 additions and 5 deletions.
  1. +2 −0 Gemfile
  2. +3 −0 README.md
  3. +4 −4 lib/logglier/client.rb
  4. +1 −1 logglier.gemspec
View
2 Gemfile
@@ -1,3 +1,5 @@
+source :rubygems
+
gemspec
platforms :jruby do
View
3 README.md
@@ -67,6 +67,9 @@ Example:
Logglier.new('https://logs.loggly.com/inputs/<id>',
:format => :json)
+Logglier uses [MultiJson](https://github.com/intridea/multi_json) to delegate the choice of JSON libraries to you, but I recommend using
+[Yajl](https://github.com/brianmario/yajl-ruby), just require the json gem of your choice before logglier.
+
### Syslog TCP/UDP Inputs
Logglier.new('[udp|tcp]://<hostname>:<port>/<facility>')
View
8 lib/logglier/client.rb
@@ -1,4 +1,4 @@
-require 'json'
+require 'multi_json'
module Logglier
module Client
@@ -60,9 +60,9 @@ def masher(hash, prefix=nil)
def formatter
proc do |severity, datetime, progname, msg|
if @format == :json && msg.is_a?(Hash)
- msg.merge!({ :severity => severity,
- :datetime => datetime,
- :progname => progname }).to_json
+ MultiJson.dump(msg.merge({ :severity => severity,
+ :datetime => datetime,
+ :progname => progname }))
else
message = "#{datetime} "
message << massage_message(msg, severity)
View
2 logglier.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec', '~> 2.11.0'
- s.add_development_dependency 'yajl-ruby'
+ s.add_development_dependency 'multi_json'
end

0 comments on commit 189059a

Please sign in to comment.
Something went wrong with that request. Please try again.