lib/phi_attrs/logger.rb in phi_attrs-0.1.4 vs lib/phi_attrs/logger.rb in phi_attrs-0.2.0
- old
+ new
@@ -1,8 +1,20 @@
+# frozen_string_literal: true
+
module PhiAttrs
+ PHI_ACCESS_LOG_TAG = 'PHI Access Log'
+
class Logger
class << self
- cattr_accessor :logger
+ def logger
+ unless @logger
+ logger = ActiveSupport::Logger.new(PhiAttrs.log_path)
+ logger.formatter = Formatter.new
+ @logger = ActiveSupport::TaggedLogging.new(logger)
+ end
+ @logger
+ end
+
delegate :debug, :info, :warn, :error, :fatal, :tagged, to: :logger
end
end
end