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]
47 48 49 50 51 |
# File 'lib/pwn/plugins/pwn_logger.rb', line 47 public_class_method def self. 'AUTHOR(S): 0day Inc. <[email protected]> ' end |
.create(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::Plugins::PWNLogger.create( )
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 43 |
# File 'lib/pwn/plugins/pwn_logger.rb', line 14 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%z' logger.formatter = proc do |severity, _datetime, _progname, msg| # TODO: Include datetime & progname vars "[#{severity}] #{PWN::Redaction.redact(value: PWN::Redaction.redact(value: msg).to_s)}\n" end logger rescue StandardError => e raise e end |
.help ⇒ Object
Display Usage for this Module
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/pwn/plugins/pwn_logger.rb', line 55 public_class_method def self.help puts "USAGE: # Run create and return its result #{self}.create( level: 'optional - level value consumed by #create' ) # Print the AUTHOR(S) string for this module. #{self}.authors " constants.sort end |