1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00
fab-manager/lib/sso_logger.rb
2023-03-22 17:30:37 +01:00

28 lines
610 B
Ruby

# frozen_string_literal: true
# This class provides logging functionalities for SSO authentication
class SsoLogger
def initialize
@logger = ActiveSupport::TaggedLogging.new(Logger.new($stdout))
@log_status = ENV.fetch('SSO_DEBUG', false)
end
def debug(message)
return unless @log_status
@logger.tagged('SSO') { @logger.debug(message) }
end
def info(message)
@logger.tagged('SSO') { @logger.info(message) }
end
def warn(message)
@logger.tagged('SSO') { @logger.warn(message) }
end
def error(message)
@logger.tagged('SSO') { @logger.error(message) }
end
end