Class: Backup::Logger::Logfile::Options

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



61
62
63
64
65
# File 'lib/backup/logger/logfile.rb', line 61

def initialize
  @enabled = true
  @log_path = ''
  @max_bytes = 500_000
end

Instance Attribute Details

#enabledBoolean?

Enable the use of Backup’s log file.

While not necessary, as this is true by default, this may also be set on the command line using --logfile.

The use of Backup’s log file may be disabled using the command line option --no-logfile.

If --no--logfile is used on the command line, then the log file will be disabled and any setting here will be ignored.

Parameters:

  • (Boolean, nil)

Returns:

  • (Boolean, nil)

    Default: true



23
24
25
# File 'lib/backup/logger/logfile.rb', line 23

def enabled
  @enabled
end

#log_fileString (readonly)

Backup’s logfile in which backup logs can be written

As there is already a log_path, this can simply be just a file name that will be created (If not exists) on log_path directory

This may also be set on the command line using --log-file. If set on the command line, any setting here will be ignored.

Parameters:

  • (String)

Returns:

  • (String)

    Default: ‘backup.log’



49
50
51
# File 'lib/backup/logger/logfile.rb', line 49

def log_file
  @log_file
end

#log_pathString

Path to directory where Backup’s logfile will be written.

This may be given as an absolute path, or a path relative to Backup’s --root-path (which defaults to ~/Backup).

This may also be set on the command line using --log-path. If set on the command line, any setting here will be ignored.

Parameters:

  • (String)

Returns:

  • (String)

    Default: ‘log’



36
37
38
# File 'lib/backup/logger/logfile.rb', line 36

def log_path
  @log_path
end

#max_bytesInteger

Size in bytes to truncate logfile to before backup jobs are run.

This is done once before all triggers, so the maximum logfile size would be this value plus whatever the jobs produce.

Parameters:

  • (Integer)

Returns:

  • (Integer)

    Default: 500_000



59
60
61
# File 'lib/backup/logger/logfile.rb', line 59

def max_bytes
  @max_bytes
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/backup/logger/logfile.rb', line 67

def enabled?
  !!enabled
end