Table of Contents

Class ConsoleLogger

Namespace
Ando.Logging
Assembly
ando.dll

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

useColor bool

Whether to use ANSI color codes in output.

logFilePath string

Optional path for plain-text log file.

secretValues IEnumerable<string>

Optional set of secret values to redact from output.

Fields

IndentLevelEnvVar

public const string IndentLevelEnvVar = "ANDO_INDENT_LEVEL"

Field Value

string

Properties

IndentLevel

Gets the current indent level (0 for top-level, 1+ for nested builds).

public int IndentLevel { get; }

Property Value

int

Verbosity

Current verbosity level. Messages below this level are suppressed.

public LogLevel Verbosity { get; set; }

Property Value

LogLevel

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

secrets IEnumerable<string>

Debug(string)

Logs a debug message (Detailed verbosity only).

public void Debug(string message)

Parameters

message string

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

message string

Info(string)

Logs an informational message (Normal+ verbosity).

public void Info(string message)

Parameters

message string

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

level string

Log level (Info, Warning, Error, Debug).

message string

The message to display.

StepCompleted(string, TimeSpan, string?)

Logs that a step completed successfully.

public void StepCompleted(string stepName, TimeSpan duration, string? context = null)

Parameters

stepName string
duration TimeSpan
context string

StepFailed(string, TimeSpan, string?)

Logs that a step failed.

public void StepFailed(string stepName, TimeSpan duration, string? message = null)

Parameters

stepName string
duration TimeSpan
message string

StepSkipped(string, string?)

Logs that a step was skipped (e.g., condition not met).

public void StepSkipped(string stepName, string? reason = null)

Parameters

stepName string
reason string

StepStarted(string, string?)

Logs that a step has started executing.

public void StepStarted(string stepName, string? context = null)

Parameters

stepName string
context string

Warning(string)

Logs a warning message (Minimal+ verbosity).

public void Warning(string message)

Parameters

message string

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

workflowName string
scriptPath string
duration TimeSpan
stepsRun int
stepsFailed int

WorkflowStarted(string, string?, int)

Logs that a workflow has started.

public void WorkflowStarted(string workflowName, string? scriptPath = null, int totalSteps = 0)

Parameters

workflowName string
scriptPath string
totalSteps int