Class: MyLocalPutio::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/my-local-putio/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Logger

Returns a new instance of Logger.



5
6
7
# File 'lib/my-local-putio/logger.rb', line 5

def initialize(configuration)
  @configuration = configuration
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



3
4
5
# File 'lib/my-local-putio/logger.rb', line 3

def configuration
  @configuration
end

Instance Method Details

#debug(msg) ⇒ Object



17
18
19
20
# File 'lib/my-local-putio/logger.rb', line 17

def debug(msg)
  return unless debug?
  print_msg "[DEBUG][#{time_now}] #{msg}"
end

#debug?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/my-local-putio/logger.rb', line 13

def debug?
  configuration.debug
end

#log(msg) ⇒ Object



22
23
24
# File 'lib/my-local-putio/logger.rb', line 22

def log(msg)
  print_msg "[LOG][#{time_now}] #{msg}"
end

#silent?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/my-local-putio/logger.rb', line 9

def silent?
  configuration.silent
end