Sha256: 9699700947c6ccabe3cd26a26dab1540464f6a1a111f3802b51d8c91947927ae

Contents?: true

Size: 1.24 KB

Versions: 19

Compression:

Stored size: 1.24 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2019 Eric Crane.  All rights reserved.
#
# Application Logging wrapper.
#
require 'active_support'
require 'colorize'
require 'colorized_string'

module Gloo
  module App
    class Log < GlooLang::App::Log

      #
      # Write an information message to the log.
      # Also write to the console unless quiet.
      #
      def info( msg )
        @logger.info msg
        puts msg.blue unless @quiet
      end

      #
      # Write a warning message to the log.
      # Also write to the console unless quiet.
      #
      def warn( msg )
        @logger.warn msg
        puts msg.yellow unless @quiet
      end

      #
      # Write an error message to the log and set the error
      # in the engine's data heap.
      # Also write to the console unless quiet.
      #
      def error( msg, ex = nil, engine = nil )
        engine&.heap&.error&.set_to msg
        @logger.error msg
        if ex
          @logger.error ex.message
          @logger.error ex.backtrace
          puts msg.red unless @quiet
          puts ex.message.red unless @quiet
          puts ex.backtrace unless @quiet
        else
          puts msg.red unless @quiet
        end
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
gloo-1.4.2 lib/gloo/app/log.rb
gloo-1.4.1 lib/gloo/app/log.rb
gloo-1.4.0 lib/gloo/app/log.rb
gloo-1.3.3 lib/gloo/app/log.rb
gloo-1.3.2 lib/gloo/app/log.rb
gloo-1.3.1 lib/gloo/app/log.rb
gloo-1.3.0 lib/gloo/app/log.rb
gloo-1.2.10 lib/gloo/app/log.rb
gloo-1.2.9 lib/gloo/app/log.rb
gloo-1.2.8 lib/gloo/app/log.rb
gloo-1.2.7 lib/gloo/app/log.rb
gloo-1.2.6 lib/gloo/app/log.rb
gloo-1.2.5 lib/gloo/app/log.rb
gloo-1.2.4 lib/gloo/app/log.rb
gloo-1.2.3 lib/gloo/app/log.rb
gloo-1.2.2 lib/gloo/app/log.rb
gloo-1.2.0 lib/gloo/app/log.rb
gloo-1.1.0 lib/gloo/app/log.rb
gloo-1.0.0 lib/gloo/app/log.rb