Sha256: 74455917c3dc057b2ba1943e08cc7200198321bd58d36ad2b0e6a6de30e29643

Contents?: true

Size: 778 Bytes

Versions: 142

Compression:

Stored size: 778 Bytes

Contents

# frozen_string_literal: true

require 'logger'

module Cryptum
  # This plugin is used to instantiate a Cryptum logger with a custom message format
  module Log
    # Supported Method Parameters::
    # Cryptum::Log.create(
    # )
    public_class_method def self.create
      logger = Logger.new($stdout)
      logger.level = Logger::INFO
      logger.datetime_format = '%Y-%m-%d %H:%M:%S'

      logger.formatter = proc do |severity, _datetime, _progname, msg|
        # TODO: Include datetime & progname vars
        "[#{severity}] #{msg}\n"
      end

      logger
    rescue StandardError => e
      raise e
    end

    # Display Usage for this Module

    public_class_method def self.help
      puts "USAGE:
        logger = #{self}.create()
      "
    end
  end
end

Version data entries

142 entries across 142 versions & 1 rubygems

Version Path
cryptum-0.0.231 lib/cryptum/log.rb
cryptum-0.0.230 lib/cryptum/log.rb