Module: INat::App::Logger::DSL

Includes:
Config
Included in:
INat::API, Task::DSL, DB, Data::Entity, Data::Entity, Data::Model, Query
Defined in:
lib/inat/app/globals.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.debug(message) ⇒ Object



73
74
75
# File 'lib/inat/app/globals.rb', line 73

def debug message
  log message, level: MessageLevel::DEBUG
end

.echo(message, level: MessageLevel::UNKNOWN) ⇒ Object



77
78
79
# File 'lib/inat/app/globals.rb', line 77

def echo message, level: MessageLevel::UNKNOWN
  log message, level: level
end

.error(message, exception: nil) ⇒ Object

Raises:

  • (exception)


60
61
62
63
# File 'lib/inat/app/globals.rb', line 60

def error message, exception: nil
  log message, level: MessageLevel::ERROR
  raise exception, message if Class === exception && Exception >= exception
end

.info(message) ⇒ Object



69
70
71
# File 'lib/inat/app/globals.rb', line 69

def info message
  log message, level: MessageLevel::INFO
end

.log(message, level: MessageLevel::INFO) ⇒ Object



54
55
56
57
58
# File 'lib/inat/app/globals.rb', line 54

def log message, level: MessageLevel::INFO
  G.status.wrap do
    G.logger.log(G.current_task&.name || '‹main›', level, message)
  end
end

.warning(message) ⇒ Object



65
66
67
# File 'lib/inat/app/globals.rb', line 65

def warning message
  log message, level: MessageLevel::WARNING
end

Instance Method Details

#debug(message) ⇒ Object (private)



73
74
75
# File 'lib/inat/app/globals.rb', line 73

def debug message
  log message, level: MessageLevel::DEBUG
end

#echo(message, level: MessageLevel::UNKNOWN) ⇒ Object (private)



77
78
79
# File 'lib/inat/app/globals.rb', line 77

def echo message, level: MessageLevel::UNKNOWN
  log message, level: level
end

#error(message, exception: nil) ⇒ Object (private)

Raises:

  • (exception)


60
61
62
63
# File 'lib/inat/app/globals.rb', line 60

def error message, exception: nil
  log message, level: MessageLevel::ERROR
  raise exception, message if Class === exception && Exception >= exception
end

#info(message) ⇒ Object (private)



69
70
71
# File 'lib/inat/app/globals.rb', line 69

def info message
  log message, level: MessageLevel::INFO
end

#log(message, level: MessageLevel::INFO) ⇒ Object (private)



54
55
56
57
58
# File 'lib/inat/app/globals.rb', line 54

def log message, level: MessageLevel::INFO
  G.status.wrap do
    G.logger.log(G.current_task&.name || '‹main›', level, message)
  end
end

#warning(message) ⇒ Object (private)



65
66
67
# File 'lib/inat/app/globals.rb', line 65

def warning message
  log message, level: MessageLevel::WARNING
end