Browse Source

wrap + object OK

pagy
pvincent 10 months ago
parent
commit
4c9c8009cb
  1. 13
      app/controllers/scores_controller.rb
  2. 2
      lib/formatters/basic_formatter.rb

13
app/controllers/scores_controller.rb

@ -5,15 +5,14 @@ class ScoresController < ApplicationController
# GET /scores # GET /scores
def index def index
@scores = Score.all @scores = Score.all
# logger.debug 'this is a debug message'
logger.info(' ' + '*' * 200)
logger.debug 'this is a debug message'
logger.debug({ 'one': 1, 'two': 2 }) logger.debug({ 'one': 1, 'two': 2 })
logger.info 'this is an information', { 'four': 4, 'five': 5 } logger.info 'this is an information', { 'four': 4, 'five': 5 }
# logger.info 'this is an object', BigDecimal('0.0001')
# logger.warn 'this is a warning'
# logger.error 'this is an error', BigDecimal('0.0002')
# logger.fatal 'FATAL'
# logger.debug 'score are', @scores
logger.info 'this is an object', BigDecimal('0.0001')
logger.warn 'this is a warning'
logger.error 'this is an error', BigDecimal('0.0002')
logger.fatal 'FATAL'
logger.debug 'scores are', @scores
end end
# GET /scores/1 # GET /scores/1

2
lib/formatters/basic_formatter.rb

@ -7,7 +7,7 @@ require 'amazing_print'
class BasicFormatter < SemanticLogger::Formatters::Color class BasicFormatter < SemanticLogger::Formatters::Color
NAME_MAX_SIZE = 25 NAME_MAX_SIZE = 25
TERMINAL_PREFIX = ENV['TERMINAL_PREFIX'].to_i || 0 TERMINAL_PREFIX = ENV['TERMINAL_PREFIX'].to_i || 0
CONTENT_PREFIX = '---'.freeze
CONTENT_PREFIX = ' '.freeze
ANSI_DEBUG = "\e[90m".freeze ANSI_DEBUG = "\e[90m".freeze
ANSI_INFO = SemanticLogger::AnsiColors::GREEN ANSI_INFO = SemanticLogger::AnsiColors::GREEN

Loading…
Cancel
Save