Module: Thron

Extended by:
Thron
Included in:
Thron
Defined in:
lib/thron/root.rb,
lib/thron/user.rb,
lib/thron/route.rb,
lib/thron/config.rb,
lib/thron/logger.rb,
lib/thron/version.rb,
lib/thron/pageable.rb,
lib/thron/response.rb,
lib/thron/routable.rb,
lib/thron/paginator.rb,
lib/thron/entity/base.rb,
lib/thron/entity/image.rb,
lib/thron/gateway/apps.rb,
lib/thron/gateway/base.rb,
lib/thron/gateway/client.rb,
lib/thron/gateway/device.rb,
lib/thron/circuit_breaker.rb,
lib/thron/gateway/comment.rb,
lib/thron/gateway/contact.rb,
lib/thron/gateway/content.rb,
lib/thron/gateway/session.rb,
lib/thron/gateway/category.rb,
lib/thron/gateway/delivery.rb,
lib/thron/gateway/metadata.rb,
lib/thron/gateway/dashboard.rb,
lib/thron/string_extensions.rb,
lib/thron/gateway/apps_admin.rb,
lib/thron/gateway/repository.rb,
lib/thron/gateway/content_list.rb,
lib/thron/gateway/access_manager.rb,
lib/thron/gateway/v_user_manager.rb,
lib/thron/gateway/content_category.rb,
lib/thron/gateway/publishing_process.rb,
lib/thron/gateway/users_group_manager.rb,
lib/thron/gateway/publish_in_weebo_express.rb

Defined Under Namespace

Modules: Config, Entity, Gateway, Pageable, Routable, StringExtensions Classes: CircuitBreaker, Paginator, Response, Route, User

Constant Summary collapse

LOGGER_FILE =
Thron::root.join('log', 'thron.log')
LOGGER_LEVELS =
i[debug info warn error fatal unknown]
VERSION =
"0.7.0"

Instance Method Summary collapse

Instance Method Details

#logger(options = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/thron/logger.rb', line 14

def logger(options = {})
  file = options.fetch(:file) { LOGGER_FILE }
  level = options.fetch(:level) { Config::logger::level }
  @logger ||= Logger.new(file).tap do |logger|
    logger.level = level
  end
end

#logger_levelObject



10
11
12
# File 'lib/thron/logger.rb', line 10

def logger_level
  LOGGER_LEVELS.fetch(logger.level)
end

#reset_logger(logger = Logger.new(STDOUT)) ⇒ Object



22
23
24
# File 'lib/thron/logger.rb', line 22

def reset_logger(logger = Logger.new(STDOUT))
  @logger = logger
end

#rootObject



6
7
8
# File 'lib/thron/root.rb', line 6

def root
  @root ||= Pathname.new(File.expand_path(File.join('..', '..', '..'), __FILE__))
end