Sha256: 4e11782724523a6a8d9b37f74f00ad9b2eaeda7b0f591efd4a8dc98d19b0cac8
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 KB
Contents
require_relative 'log_factory_manager' require_relative 'log_factory_repository' controller_name = 'test_controller' userID = 5 # RTALogger::LogFactory.register_log_repository :console, 'log_repository_console.rb' # create log manager instance # this could be a global variable declared in application level log_manager = RTALogger::LogFactory.log_manager_instance # set log manage application name (hard code) log_manager.app_name = 'myTestApp' # load log manager configuration from a json config file log_manager.config_use_json_file('rta_logger_config.json') # add log repository to log manager #log_manager.propagator.add_log_repository(RTALogger::LogFactory.new_log_repository_console) # add new topic to log manager # use this api to get a new log topic instance # this api could be called in entry point of each service or class initialize method topic = log_manager.add_topic(controller_name) test_topic = log_manager.add_topic('test') # test_topic.severity_level = ::RTALogger::SeverityLevel::FATAL # test_topic.enable = false # add log information to log topic topic.trace(userID, 'Controller Name=', controller_name, 'trace') topic.debug(userID, 'Controller Name=', controller_name, 'debug') topic.info(userID, 'Controller Name=', controller_name, 'information') topic.warning(userID, 'Controller Name=', controller_name, 'warning') topic.error(userID, 'Controller Name=', controller_name, 'error') topic.fatal(userID, 'Controller Name=', controller_name, 'fatal') topic.unknown(userID, 'Controller Name=', controller_name, 'unknown') test_topic.error(userID, 'test_topic', 'error') test_topic.fatal(userID, 'test_topic', 'fatal') # puts log_manager.reveal_config # update specific topic log level if necessary # log_manager.update_topic_level(controller_name, RTALogger::SeverityLevel::INFO) # update all topics log level if necessary # log_manager.update_all_topics_severity_level(RTALogger::SeverityLevel::INFO)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
RTALogger-2.1.2 | lib/sample.rb |
RTALogger-2.1.1 | lib/sample.rb |
RTALogger-2.1.0 | lib/sample.rb |