Browse Source

tag_wrap_error building

main
pvincent 3 months ago
parent
commit
e39c73fe75
  1. 1
      app/controllers/scores_controller.rb
  2. 17
      lib/monkey_patches/semantic_logger.rb
  3. 8
      lib/monkey_patches/semantic_logger/appenders.rb
  4. 0
      lib/monkey_patches/semantic_logger/base.rb
  5. 3
      lib/semantic/ansi_formatter.rb
  6. 2
      lib/semantic/tag_wrap_error.rb

1
app/controllers/scores_controller.rb

@ -37,6 +37,7 @@ class ScoresController < ApplicationController
end
def destroy
aazazaz
# @score.destroy!
# redirect_to scores_url, notice: 'Score was successfully destroyed.', status: :see_other

17
lib/monkey_patches/semantic_logger.rb

@ -0,0 +1,17 @@
module SemanticLogger
def self.fast_tag(tag)
return yield if tag.nil? || tag == ''
t = Thread.current[:semantic_logger_tags] ||= []
begin
t << tag
yield
# PVINCENT's addition
rescue StandardError => e
raise Semantic::TagWrapError.new(tag, e)
# END OF addition
ensure
t.pop
end
end
end

8
lib/monkey_patches/semantic_logger/appenders.rb

@ -1,17 +1,19 @@
module SemanticLogger
# Manage a collection of appenders.
class Appenders < Concurrent::Array
def close
closed_appenders = []
each do |appender|
logger.trace "Closing appender: #{appender.name}"
closed_appenders << appender
# PVINCENT's change
closed_appenders << appender # closed_ missing!!!!
# END OF change
appender.flush
appender.close
rescue Exception => e
logger.error "Failed to close appender: #{appender.name}", e
end
# Delete appenders outside the #each above which prevents changes during iteration.
closed_appenders.each { |appender| delete(appender) }
logger.trace 'All appenders closed and removed from appender list'
end

0
lib/monkey_patches/rails_semantic_logger/base.rb → lib/monkey_patches/semantic_logger/base.rb

3
lib/semantic/ansi_formatter.rb

@ -29,7 +29,7 @@ module Semantic
end
def call(log, logger)
# puts 'ok'
# puts 'ok2'
log = alter(log)
self.log = log
@ -167,6 +167,7 @@ module Semantic
if log.exception.is_a?(Semantic::TagWrapError)
exc_wrapper = log.exception
# puts "TAG_WRAP detected #{exc_wrapper.tag}"
exc = exc_wrapper.error
log.tags = Array.wrap(exc_wrapper.tag)
else

2
lib/semantic/tag_wrap_error.rb

@ -9,6 +9,6 @@ module Semantic
super("my error message contains tag #{tag}")
end
def to_s = "TagWrap #{@tag}"
def to_s = "#{self.class}#{@tag}"
end
end
Loading…
Cancel
Save