Class: Backup::Logger::Syslog::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/backup/logger/syslog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



82
83
84
85
86
87
88
89
90
# File 'lib/backup/logger/syslog.rb', line 82

def initialize
  @enabled = false
  @ident = 'backup'
  @options = ::Syslog::LOG_PID
  @facility = ::Syslog::LOG_LOCAL0
  @info = ::Syslog::LOG_INFO
  @warn = ::Syslog::LOG_WARNING
  @error = ::Syslog::LOG_ERR
end

Instance Attribute Details

#enabledBoolean?

Enables logging to the system’s Syslog compatible logger.

This may also be enabled using --syslog on the command line.

If --no-syslog is used on the command line, this will be disabled and any settings here will be ignored.

Parameters:

  • (Boolean, nil)

Returns:

  • (Boolean, nil)

    Default: false



17
18
19
# File 'lib/backup/logger/syslog.rb', line 17

def enabled
  @enabled
end

#errorInteger

Specify the priority level to be used for :error messages.

See the Ruby Standard Library documentation for Syslog for more info. rdoc.info/stdlib/syslog/Syslog.log

Parameters:

  • (Integer)

Returns:

  • (Integer)

    Default: Syslog::LOG_ERR



80
81
82
# File 'lib/backup/logger/syslog.rb', line 80

def error
  @error
end

#facilityInteger

Specify the facility to be used with Syslog.

See the Ruby Standard Library documentation for Syslog for more info. rdoc.info/stdlib/syslog/Syslog.open

Note that setting this to nil will cause this to default to a setting of Syslog::LOG_USER

Parameters:

  • (Integer)

Returns:

  • (Integer)

    Default: Syslog::LOG_LOCAL0



50
51
52
# File 'lib/backup/logger/syslog.rb', line 50

def facility
  @facility
end

#identString

Specify the identification string to be used with Syslog.

Parameters:

  • (String)

Returns:

  • (String)

    Default: ‘backup’



24
25
26
# File 'lib/backup/logger/syslog.rb', line 24

def ident
  @ident
end

#infoInteger

Specify the priority level to be used for :info messages.

See the Ruby Standard Library documentation for Syslog for more info. rdoc.info/stdlib/syslog/Syslog.log

Parameters:

  • (Integer)

Returns:

  • (Integer)

    Default: Syslog::LOG_INFO



60
61
62
# File 'lib/backup/logger/syslog.rb', line 60

def info
  @info
end

#optionsInteger

Specify the options to be used with Syslog.

See the Ruby Standard Library documentation for Syslog for more info. rdoc.info/stdlib/syslog/Syslog.open

Note that setting this to nil will cause this to default to a setting of Syslog::LOG_PID | Syslog::LOG_CONS

Parameters:

  • (Integer)

Returns:

  • (Integer)

    Default: Syslog::LOG_PID



37
38
39
# File 'lib/backup/logger/syslog.rb', line 37

def options
  @options
end

#warnInteger

Specify the priority level to be used for :warn messages.

See the Ruby Standard Library documentation for Syslog for more info. rdoc.info/stdlib/syslog/Syslog.log

Parameters:

  • (Integer)

Returns:

  • (Integer)

    Default: Syslog::LOG_WARNING



70
71
72
# File 'lib/backup/logger/syslog.rb', line 70

def warn
  @warn
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/backup/logger/syslog.rb', line 92

def enabled?
  !!enabled
end