Class: Splash::Loggers::Web
- Inherits:
-
LoggerTemplate
- Object
- LoggerTemplate
- Splash::Loggers::Web
- Defined in:
- lib/splash/loggers/web.rb
Overview
Web specific logger
Constant Summary
Constants included from Constants
Constants::AUTHOR, Constants::BACKENDS_STRUCT, Constants::CONFIG_FILE, Constants::COPYRIGHT, Constants::DAEMON_LOGMON_SCHEDULING, Constants::DAEMON_METRICS_SCHEDULING, Constants::DAEMON_PID_FILE, Constants::DAEMON_PROCESS_NAME, Constants::DAEMON_PROCMON_SCHEDULING, Constants::DAEMON_STDERR_TRACE, Constants::DAEMON_STDOUT_TRACE, Constants::DEFAULT_RETENTION, Constants::EMAIL, Constants::EXECUTION_TEMPLATE, Constants::EXECUTION_TEMPLATE_TOKENS_LIST, Constants::LICENSE, Constants::LOGGERS_STRUCT, Constants::PID_PATH, Constants::PROMETHEUS_ALERTMANAGER_URL, Constants::PROMETHEUS_PUSHGATEWAY_URL, Constants::PROMETHEUS_URL, Constants::TRACE_PATH, Constants::TRANSPORTS_STRUCT, Constants::VERSION, Constants::WEBADMIN_IP, Constants::WEBADMIN_PID_FILE, Constants::WEBADMIN_PID_PATH, Constants::WEBADMIN_PORT, Constants::WEBADMIN_PROCESS_NAME, Constants::WEBADMIN_PROXY, Constants::WEBADMIN_STDERR_TRACE, Constants::WEBADMIN_STDOUT_TRACE
Instance Method Summary collapse
-
#close ⇒ Object
close log file descriptor.
-
#initialize ⇒ Splash::Loggers::Web
constructor
contructor, open log file.
-
#log(options) ⇒ Object
log wrapper write formatted string to log file.
Methods inherited from LoggerTemplate
Methods included from Config
Methods included from ConfigUtilities
#addservice, #checkconfig, #flush_backend, #setupsplash
Methods included from Helpers
#check_unicode_term, #daemonize, #format_by_extensions, #format_response, #get_processes, #group_root, #install_file, #is_root?, #make_folder, #make_link, #run_as_root, #search_file_in_gem, #user_root, #verify_file, #verify_folder, #verify_link, #verify_service
Constructor Details
#initialize ⇒ Splash::Loggers::Web
contructor, open log file
15 16 17 18 19 20 |
# File 'lib/splash/loggers/web.rb', line 15 def initialize self.level = get_config.loggers[:level] @log_file = get_config.loggers[:web][:file] @stream = File::open(@log_file, 'a') @stream.sync = true end |
Instance Method Details
#close ⇒ Object
close log file descriptor
42 43 44 |
# File 'lib/splash/loggers/web.rb', line 42 def close @stream.close end |
#log(options) ⇒ Object
log wrapper write formatted string to log file
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/splash/loggers/web.rb', line 28 def log() pid = Process.pid.to_s date = DateTime.now.to_s level = (ALIAS.keys.include? [:level])? ALIAS[[:level]] : [:level] if @active_levels.include? level then unless [:session].empty? then @stream.puts "[#{date}] (#{pid}) (#{[:session]}) #{alt([:level])} : #{[:message]}" else @stream.puts "[#{date}] (#{pid}) #{alt([:level])} : #{[:message]}" end end end |