Class: MJ::Logging::LoggerAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/mj/logging.rb

Overview

:TODO: Map the Logging Levels to Logger Levels instead of hardcoding them here.

Instance Method Summary collapse

Constructor Details

#initialize(prefix) ⇒ LoggerAdapter

Returns a new instance of LoggerAdapter.



49
50
51
# File 'lib/mj/logging.rb', line 49

def initialize( prefix )
    @prefix = prefix.upcase
end

Instance Method Details

#debug(string) ⇒ Object



53
54
55
# File 'lib/mj/logging.rb', line 53

def debug( string )
    logger.debug( "<#{@prefix}> #{string}" )
end

#debug?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/mj/logging.rb', line 57

def debug?
    return logger.level > ::Logging.level_num(:debug)
end

#error(string) ⇒ Object



81
82
83
# File 'lib/mj/logging.rb', line 81

def error( string )
    logger.error( "<#{@prefix}> #{string}" )
end

#error?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/mj/logging.rb', line 85

def error?
    return logger.level > ::Logging.level_num(:error)
end

#fatal(string) ⇒ Object



89
90
91
# File 'lib/mj/logging.rb', line 89

def fatal( string )
    logger.error( "<#{@prefix}> #{string}" )
end

#fatal?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/mj/logging.rb', line 93

def fatal?
    return logger.level > ::Logging.level_num(:error)
end

#info(string) ⇒ Object



65
66
67
# File 'lib/mj/logging.rb', line 65

def info( string )
    logger.info( "<#{@prefix}> info #{string}" )
end

#info?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/mj/logging.rb', line 69

def info?
    return logger.level > ::Logging.level_num(:info)
end

#quiet(string) ⇒ Object



61
62
63
# File 'lib/mj/logging.rb', line 61

def quiet( string )
    logger.quiet( "<#{@prefix}> info #{string}" )
end

#unknown(string) ⇒ Object



97
98
99
# File 'lib/mj/logging.rb', line 97

def unknown( string )
    logger.error( "<#{@prefix}> UNKNOWN: #{string}" )
end

#warn(string) ⇒ Object



73
74
75
# File 'lib/mj/logging.rb', line 73

def warn( string )
    logger.arn( "<#{@prefix}> #{string}" )
end

#warn?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/mj/logging.rb', line 77

def warn?
    return logger.level > ::Logging.level_num(:warn)
end