Module: Docker::Registry::Sync::STDLogger

Defined in:
lib/docker/registry/sync/configuration.rb

Class Method Summary collapse

Class Method Details

.debug(msg) ⇒ Object



32
33
34
35
36
37
# File 'lib/docker/registry/sync/configuration.rb', line 32

def debug(msg)
  if do_log?(:debug, Docker::Registry::Sync.config.log_level)
    STDOUT.puts "[DEBUG] #{msg}"
    STDOUT.flush
  end
end

.do_log?(requested_lvl, curr_lvl) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/docker/registry/sync/configuration.rb', line 26

def do_log?(requested_lvl, curr_lvl)
  curr_lvl = Docker::Registry::Sync::STDLogLvl.send(curr_lvl.to_sym)
  requested_lvl = Docker::Registry::Sync::STDLogLvl.send(requested_lvl.to_sym)
  requested_lvl >= curr_lvl
end

.error(msg) ⇒ Object



46
47
48
49
50
51
# File 'lib/docker/registry/sync/configuration.rb', line 46

def error(msg)
  if do_log?(:error, Docker::Registry::Sync.config.log_level)
    STDERR.puts "[ERROR] #{msg}"
    STDERR.flush
  end
end

.info(msg) ⇒ Object



39
40
41
42
43
44
# File 'lib/docker/registry/sync/configuration.rb', line 39

def info(msg)
  if do_log?(:info, Docker::Registry::Sync.config.log_level)
    STDOUT.puts "[INFO] #{msg}"
    STDOUT.flush
  end
end