Sha256: 6b94dcb17decfab4220b2c5ccf6c2de8f0781f197f0a50d4ef52c73cb2669c9a

Contents?: true

Size: 901 Bytes

Versions: 3

Compression:

Stored size: 901 Bytes

Contents

module OhMyLog
  class SyslogConfiguration
    @@processor_name = "RFC3164"
    @@split_operation = "split"

    def self.use(processor_name = nil, operation = nil)
      change_processor(processor_name) if processor_name
      change_operation(operation) if operation
    end

    def self.processor_name
      return @@processor_name
    end

    def self.split_operation
      return @@split_operation
    end

    def self.change_processor(processor_name)
      raise "We don't support the #{processor_name} format" unless (("SyslogProcessors::#{processor_name.upcase}".constantize) rescue false)
      @@processor_name = processor_name
    end

    def self.change_operation(operation)
      operation = operation.to_s.downcase.to_sym
      raise ArgumentError "Supported mode are: 'split' or 'trim'" unless [:split, :trim].include? operation
      @@split_operation = operation
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oh_my_log-1.0.5 lib/oh_my_log/syslog_configuration.rb
oh_my_log-1.0.4 lib/oh_my_log/syslog_configuration.rb
oh_my_log-1.0.3 lib/oh_my_log/syslog_configuration.rb