Class ConsoleLogger
Production logger with colorized console output and file logging. Uses ANSI escape codes for colors and Unicode symbols for status indicators. Supports indentation for nested builds via ANDO_INDENT_LEVEL environment variable.
public class ConsoleLogger : IBuildLogger, IMessageLogger, IStepLogger, IWorkflowLogger, IDisposable
- Inheritance
-
ConsoleLogger
- Implements
- Inherited Members
Constructors
ConsoleLogger(bool, string?, IEnumerable<string>?)
Creates a new console logger.
public ConsoleLogger(bool useColor = true, string? logFilePath = null, IEnumerable<string>? secretValues = null)
Parameters
useColorboolWhether to use ANSI color codes in output.
logFilePathstringOptional path for plain-text log file.
secretValuesIEnumerable<string>Optional set of secret values to redact from output.
Fields
IndentLevelEnvVar
public const string IndentLevelEnvVar = "ANDO_INDENT_LEVEL"
Field Value
Properties
IndentLevel
Gets the current indent level (0 for top-level, 1+ for nested builds).
public int IndentLevel { get; }
Property Value
Verbosity
Current verbosity level. Messages below this level are suppressed.
public LogLevel Verbosity { get; set; }
Property Value
Methods
AddSecrets(IEnumerable<string>)
Adds secret values to be redacted from output. Can be called after construction when secrets become known.
public void AddSecrets(IEnumerable<string> secrets)
Parameters
secretsIEnumerable<string>
Debug(string)
Logs a debug message (Detailed verbosity only).
public void Debug(string message)
Parameters
messagestring
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Error(string)
Logs an error message (always shown).
public void Error(string message)
Parameters
messagestring
Info(string)
Logs an informational message (Normal+ verbosity).
public void Info(string message)
Parameters
messagestring
LogStep(string, string)
Logs a log step as a single line with the message inline. Format: "▶ [1/5] Info: message"
public void LogStep(string level, string message)
Parameters
StepCompleted(string, TimeSpan, string?)
Logs that a step completed successfully.
public void StepCompleted(string stepName, TimeSpan duration, string? context = null)
Parameters
StepFailed(string, TimeSpan, string?)
Logs that a step failed.
public void StepFailed(string stepName, TimeSpan duration, string? message = null)
Parameters
StepSkipped(string, string?)
Logs that a step was skipped (e.g., condition not met).
public void StepSkipped(string stepName, string? reason = null)
Parameters
StepStarted(string, string?)
Logs that a step has started executing.
public void StepStarted(string stepName, string? context = null)
Parameters
Warning(string)
Logs a warning message (Minimal+ verbosity).
public void Warning(string message)
Parameters
messagestring
WorkflowCompleted(string, string?, TimeSpan, int, int)
Logs that a workflow has completed.
public void WorkflowCompleted(string workflowName, string? scriptPath, TimeSpan duration, int stepsRun, int stepsFailed)
Parameters
WorkflowStarted(string, string?, int)
Logs that a workflow has started.
public void WorkflowStarted(string workflowName, string? scriptPath = null, int totalSteps = 0)