mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
- Fall back sanely if we don't have awesome_print
This commit is contained in:
parent
4f6e8f5cf7
commit
3e5441a54b
1 changed files with 12 additions and 2 deletions
|
@ -1,8 +1,14 @@
|
|||
require "ap"
|
||||
require "ap"
|
||||
require "logstash/outputs/base"
|
||||
require "logstash/namespace"
|
||||
|
||||
class LogStash::Outputs::Stdout < LogStash::Outputs::Base
|
||||
begin
|
||||
require "ap"
|
||||
HAVE_AWESOME_PRINT = true
|
||||
rescue => e
|
||||
HAVE_AWESOME_PRINT = false
|
||||
end
|
||||
|
||||
config_name "stdout"
|
||||
config :debug, :validate => :boolean
|
||||
|
@ -22,7 +28,11 @@ class LogStash::Outputs::Stdout < LogStash::Outputs::Base
|
|||
public
|
||||
def receive(event)
|
||||
if @debug
|
||||
ap event.to_hash
|
||||
if HAVE_AWESOME_PRINT
|
||||
ap event.to_hash
|
||||
else
|
||||
p event.to_hash
|
||||
end
|
||||
else
|
||||
puts event.to_s
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue