Module: Utter

Defined in:
lib/utter.rb,
lib/utter/service.rb,
lib/generators/utils/tips.rb,
lib/generators/ext_gem_generator.rb,
lib/generators/domain_gem_generator.rb,
lib/generators/service_gem_generator.rb,
lib/generators/auth_consumer_ext_gem_generator.rb,
lib/generators/project_container_gem_generator.rb

Overview

require ‘net/http’ #TODO not needed as calling other services is done in Utter Domain Extensions, Net::HTTP.get(‘example.com’, ‘/index.html’) # => String

Defined Under Namespace

Modules: Auth, Generators, Utils Classes: Context, Service

Constant Summary collapse

VERSION =

MAJOR version when you make incompatible API changes MINOR version when you add functionality in a backwards-compatible manner PATCH version when you make backwards-compatible bug fixes.

"1.9.0"

Class Method Summary collapse

Class Method Details

.logger(shift_age: 'daily', datetime_format: '%Y-%m-%d %H:%M:%S', log_dir: 'logs') ⇒ Object

UNKNOWN: An unknown message that should always be logged. FATAL: An unhandleable error that results in a program crash. ERROR: A handleable error condition. WARN: A warning. INFO: Generic (useful) information about system operation. DEBUG: Low-level information for developers.



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

def self.logger(shift_age: 'daily',
  datetime_format: '%Y-%m-%d %H:%M:%S',
  log_dir: 'logs'
 )

  Dir.mkdir(log_dir) unless File.exists?(log_dir)
  logger_file = "#{log_dir}/#{DateTime.now.strftime('%m_%d_%Y')}.log"
  file = File.open(logger_file, File::WRONLY | File::APPEND | File::CREAT)

  @log = Logger.new("| tee " + file.path, shift_age)
  @log.datetime_format = datetime_format

  @log.info "Utter Log Levels: DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN"
  return @log
end