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.



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

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



15
16
17
# File 'lib/backup/logger/syslog.rb', line 15

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



78
79
80
# File 'lib/backup/logger/syslog.rb', line 78

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



48
49
50
# File 'lib/backup/logger/syslog.rb', line 48

def facility
  @facility
end

#identString

Specify the identification string to be used with Syslog.

Parameters:

  • (String)

Returns:

  • (String)

    Default: ‘backup’



22
23
24
# File 'lib/backup/logger/syslog.rb', line 22

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



58
59
60
# File 'lib/backup/logger/syslog.rb', line 58

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



35
36
37
# File 'lib/backup/logger/syslog.rb', line 35

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



68
69
70
# File 'lib/backup/logger/syslog.rb', line 68

def warn
  @warn
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/backup/logger/syslog.rb', line 90

def enabled?
  !!enabled
end