Module: Kuromd

Defined in:
lib/kuromd.rb,
lib/kuromd/config.rb,
lib/kuromd/folder.rb,
lib/kuromd/version.rb,
lib/kuromd/basefile.rb,
lib/kuromd/basenote.rb,
lib/kuromd/postable.rb,
lib/kuromd/configurable.rb,
lib/kuromd/journal/file.rb,
lib/kuromd/journal/note.rb,
lib/kuromd/journal/inbox.rb,
lib/kuromd/one_on_one/note.rb,
lib/kuromd/journal/fileable.rb

Overview

require ‘kuromd/journal/folder’

Defined Under Namespace

Modules: Configurable, Journal, OneOnOne, Postable Classes: BaseFile, BaseNote, Config, Error, Folder

Constant Summary collapse

VERSION =
'0.0.1'

Class Method Summary collapse

Class Method Details

.init_logger(env) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/kuromd.rb', line 28

def self.init_logger(env)
  # create the logs folder if not there
  FileUtils.mkdir_p 'logs'

  # assume production
  logfile = "logs/#{env}.log"
  logger = Logger.new(logfile)
  if env == 'development'
    logger = Logger.new(STDOUT)
    logger.level = Logger::DEBUG
  end
  logger
end

.loggerObject

TODO: create the ability to configure logger



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kuromd.rb', line 16

def self.logger

  if @logger.nil?
    env = ENV['ENVIRONMENT']
    @logger = init_logger(env)
    # @logger = Logger.new($stdout) unless ENV['ENVIRONMENT'] == 'development'
    # @logger.level = Logger::WARN
    @logger.info 'Logger initialized'
  end
  @logger
end