Sha256: a072cc51d083f7a31575c3e87b7dc6a743d61055f18ec4a38bd269c1ed81dafc
Contents?: true
Size: 1.57 KB
Versions: 470
Compression:
Stored size: 1.57 KB
Contents
# frozen_string_literal: true require 'logger' module PWN module Plugins # This plugin is used to instantiate a PWN logger with a custom message format module PWNLogger # Supported Method Parameters:: # PWN::Plugins::PWNLogger.create( # ) 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 # Author(s):: 0day Inc. <request.pentest@0dayinc.com> public_class_method def self.authors 'AUTHOR(S): 0day Inc. <request.pentest@0dayinc.com> ' end # Display Usage for this Module 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 end end end
Version data entries
470 entries across 470 versions & 1 rubygems