Class: Fron::Logger

Inherits:
Object show all
Defined in:
opal/fron/core/logger.rb

Overview

Class for logging messages with a timestamp.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Initailizes the logger



11
12
13
# File 'opal/fron/core/logger.rb', line 11

def initialize
  @level = :info
end

Instance Attribute Details

#levelSymbol

Sets / gets the log level

Parameters:

  • value (Symbol)

    The level

Returns:

  • (Symbol)

    The level



8
9
10
# File 'opal/fron/core/logger.rb', line 8

def level
  @level
end

Instance Method Details

#info(message) ⇒ Object

Logs the given message

Parameters:

  • message (String)

    The message



18
19
20
21
22
# File 'opal/fron/core/logger.rb', line 18

def info(message)
  return if ENV == 'test'
  return if @level == :error
  puts Time.now.strftime('[%H:%M] ') + message
end