Module: PWN::Plugins::PWNLogger
- Defined in:
- lib/pwn/plugins/pwn_logger.rb
Overview
This plugin is used to instantiate a PWN logger with a custom message format
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
-
0day Inc.
-
.create(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::PWNLogger.create( ).
-
.help ⇒ Object
Display Usage for this Module.
Class Method Details
.authors ⇒ Object
- Author(s)
-
0day Inc. <[email protected]>
46 47 48 49 50 |
# File 'lib/pwn/plugins/pwn_logger.rb', line 46 public_class_method def self. 'AUTHOR(S): 0day Inc. <[email protected]> ' end |
.create(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::Plugins::PWNLogger.create( )
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pwn/plugins/pwn_logger.rb', line 13 public_class_method def self.create(opts = {}) logger = Logger.new($stdout) level = opts[:level] case level.to_s.downcase.to_sym when :debug logger.level = Logger::DEBUG when :error logger.level = Logger::ERROR when :fatal logger.level = Logger::FATAL when :unknown logger.level = Logger::UNKNOWN when :warn logger.level = Logger::WARN else logger.level = Logger::INFO end logger.datetime_format = '%Y-%m-%d %H:%M:%S.%N' logger.formatter = proc do |severity, _datetime, _progname, msg| # TODO: Include datetime & progname vars "[#{severity}] #{msg}\n" end logger rescue StandardError => e raise e end |
.help ⇒ Object
Display Usage for this Module
54 55 56 57 58 59 60 61 |
# File 'lib/pwn/plugins/pwn_logger.rb', line 54 public_class_method def self.help puts "USAGE: logger = #{self}.create( level: 'optional - logging verbosity :debug|:error|:fatal|:info|:unknown|:warn (Defaults to :info)' ) #{self}.authors " end |