Class: Ocak::PipelineLogger
- Inherits:
-
Object
- Object
- Ocak::PipelineLogger
- Defined in:
- lib/ocak/logger.rb
Constant Summary collapse
- COLORS =
{ reset: "\e[0m", bold: "\e[1m", dim: "\e[2m", red: "\e[31m", green: "\e[32m", yellow: "\e[33m", blue: "\e[34m", magenta: "\e[35m", cyan: "\e[36m", white: "\e[37m" }.freeze
- AGENT_COLORS =
{ 'implementer' => :cyan, 'reviewer' => :magenta, 'security-reviewer' => :red, 'auditor' => :yellow, 'documenter' => :blue, 'merger' => :green, 'planner' => :white, 'pipeline' => :cyan }.freeze
Instance Attribute Summary collapse
-
#log_file_path ⇒ Object
readonly
Returns the value of attribute log_file_path.
Instance Method Summary collapse
-
#debug(msg, agent: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
- #error(msg, agent: nil) ⇒ Object
- #info(msg, agent: nil) ⇒ Object
-
#initialize(log_dir: nil, issue_number: nil, color: $stderr.tty?) ⇒ PipelineLogger
constructor
A new instance of PipelineLogger.
- #warn(msg, agent: nil) ⇒ Object
Constructor Details
#initialize(log_dir: nil, issue_number: nil, color: $stderr.tty?) ⇒ PipelineLogger
Returns a new instance of PipelineLogger.
32 33 34 35 36 |
# File 'lib/ocak/logger.rb', line 32 def initialize(log_dir: nil, issue_number: nil, color: $stderr.tty?) @color = color @mutex = Mutex.new @file_logger = setup_file_logger(log_dir, issue_number) if log_dir end |
Instance Attribute Details
#log_file_path ⇒ Object (readonly)
Returns the value of attribute log_file_path.
54 55 56 |
# File 'lib/ocak/logger.rb', line 54 def log_file_path @log_file_path end |
Instance Method Details
#debug(msg, agent: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
50 51 52 |
# File 'lib/ocak/logger.rb', line 50 def debug(msg, agent: nil) # rubocop:disable Lint/UnusedMethodArgument @file_logger&.debug(msg) end |
#error(msg, agent: nil) ⇒ Object
46 47 48 |
# File 'lib/ocak/logger.rb', line 46 def error(msg, agent: nil) log(:error, msg, agent: agent, color: :red) end |
#info(msg, agent: nil) ⇒ Object
38 39 40 |
# File 'lib/ocak/logger.rb', line 38 def info(msg, agent: nil) log(:info, msg, agent: agent) end |
#warn(msg, agent: nil) ⇒ Object
42 43 44 |
# File 'lib/ocak/logger.rb', line 42 def warn(msg, agent: nil) log(:warn, msg, agent: agent, color: :yellow) end |