Created
October 24, 2010 11:48
-
-
Save lennartkoopmann/643474 to your computer and use it in GitHub Desktop.
Example usage of GELF gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> require 'rubygems' | |
=> true | |
irb(main):002:0> require 'gelf' | |
=> true | |
irb(main):003:0> msg = Gelf.new 'localhost', 12201 | |
=> #<Gelf:0xb73a4424 @port=12201, @hostname="localhost"> | |
irb(main):004:0> msg.short_message = "Something is broken" | |
=> "Something is broken" | |
irb(main):005:0> msg.full_message = "Stacktrace\n\nmore stuff" | |
=> "Stacktrace\n\nmore stuff" | |
irb(main):006:0> msg.level = 1 | |
=> 1 | |
irb(main):007:0> msg.host = "my-app" | |
=> "my-app" | |
irb(main):008:0> msg.line = 1337 | |
=> 1337 | |
irb(main):009:0> msg.file = "/var/www/main.rb" | |
=> "/var/www/main.rb" | |
irb(main):010:0> msg.add_additional "Something", "Foo" | |
=> [{:key=>"Something", :value=>"Foo"}] | |
irb(main):011:0> msg.add_additional "Something else", "Bar" | |
=> [{:key=>"Something", :value=>"Foo"}, {:key=>"Something else", :value=>"Bar"}] | |
irb(main):012:0> msg.send | |
=> 146 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment