Skip to content

Commit

Permalink
Allow to disable file and line collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed May 17, 2011
1 parent 9d18844 commit 179927f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Expand Up @@ -20,7 +20,8 @@
+ GELF::Logger#level = GELF::INFO + GELF::Logger#level = GELF::INFO
+ allow to change severity mapping; + allow to change severity mapping;
+ send messages to receivers in round-robin; + send messages to receivers in round-robin;
* GELF::Notifier#host and #port are attr_readers now and deprecated (were attr_accessor) * GELF::Notifier#host and #port are attr_readers now and deprecated (were attr_accessor);
+ allow to disable file and line collection (GELF::Notifier#collect_file_and_line = false);
- deprecated Gelf class removed. - deprecated Gelf class removed.


1.0.2, 2010-11-29: 1.0.2, 2010-11-29:
Expand Down
5 changes: 3 additions & 2 deletions lib/gelf/notifier.rb
Expand Up @@ -6,14 +6,15 @@ class << self
attr_accessor :last_chunk_id attr_accessor :last_chunk_id
end end


attr_accessor :enabled attr_accessor :enabled, :collect_file_and_line
attr_reader :max_chunk_size, :level, :default_options, :level_mapping attr_reader :max_chunk_size, :level, :default_options, :level_mapping


# +host+ and +port+ are host/ip and port of graylog2-server. # +host+ and +port+ are host/ip and port of graylog2-server.
# +max_size+ is passed to max_chunk_size=. # +max_size+ is passed to max_chunk_size=.
# +default_options+ is used in notify! # +default_options+ is used in notify!
def initialize(host = 'localhost', port = 12201, max_size = 'WAN', default_options = {}) def initialize(host = 'localhost', port = 12201, max_size = 'WAN', default_options = {})
@enabled = true @enabled = true
@collect_file_and_line = true


self.level = GELF::DEBUG self.level = GELF::DEBUG
self.max_chunk_size = max_size self.max_chunk_size = max_size
Expand Down Expand Up @@ -153,7 +154,7 @@ def extract_hash(object = nil, args = {})


@hash = default_options.merge(self.class.stringify_keys(args.merge(primary_data))) @hash = default_options.merge(self.class.stringify_keys(args.merge(primary_data)))
convert_hoptoad_keys_to_graylog2 convert_hoptoad_keys_to_graylog2
set_file_and_line set_file_and_line if @collect_file_and_line
set_timestamp set_timestamp
check_presence_of_mandatory_attributes check_presence_of_mandatory_attributes
@hash @hash
Expand Down

0 comments on commit 179927f

Please sign in to comment.