Table of Contents

Class LoggerBase

Namespace
SunamoLogging.Base
Assembly
SunamoLogging.dll

Base logger class implementing common logging operations.

public abstract class LoggerBase : ILoggerBase
Inheritance
LoggerBase
Implements
Derived
Inherited Members
Extension Methods

Constructors

LoggerBase(Action<string, string[]>)

Base logger class implementing common logging operations.

protected LoggerBase(Action<string, string[]> writeLineDelegate)

Parameters

writeLineDelegate Action<string, string[]>

Fields

writeLineDelegate

The delegate used to write log lines.

protected Action<string, string[]> writeLineDelegate

Field Value

Action<string, string[]>

Properties

IsActive

Gets or sets whether the logger is active and should write output.

public bool IsActive { get; set; }

Property Value

bool

Methods

ClipboardOrDebug(string, params string[])

Writes output to clipboard in release mode or debug output in debug mode. Only for debug purposes.

public void ClipboardOrDebug(string text, params string[] args)

Parameters

text string

The text to write.

args string[]

Format arguments.

IsInRightFormat(string, params string[])

Checks if the text is in the right format with the provided arguments.

public bool IsInRightFormat(string text, params string[] args)

Parameters

text string

The format string to validate.

args string[]

Format arguments.

Returns

bool

True if the format is valid, false otherwise.

TwoState(bool, params string[])

Writes a two-state (boolean) value with additional data.

public void TwoState(bool state, params string[] additionalData)

Parameters

state bool

The state value.

additionalData string[]

Additional data to append.

WriteArgs(params string[])

Writes arguments separated by semicolons.

public void WriteArgs(params string[] args)

Parameters

args string[]

The arguments to write.

WriteCount(string, IList)

Writes the count of elements in a collection.

public void WriteCount(string collectionName, IList list)

Parameters

collectionName string

The name of the collection.

list IList

The collection to count.

WriteLine(string)

Writes a simple line without formatting. For compatibility with CL.WriteLine.

public void WriteLine(string text)

Parameters

text string

The text to write.

WriteLine(string, object)

Writes a labeled line with automatic ": " separator.

public void WriteLine(string label, object value)

Parameters

label string

The label/prefix.

value object

The value to write.

WriteLine(string, params string[])

Writes a formatted line if the logger is active.

public void WriteLine(string text, params string[] args)

Parameters

text string

The format string.

args string[]

Format arguments.

WriteLineFormat(string, params string[])

Writes a formatted line. Legacy compatibility method for old applications.

public void WriteLineFormat(string format, params string[] args)

Parameters

format string

The format string.

args string[]

Format arguments.

WriteLineNull(string, params string[])

Writes a line, converting null values to "(null)" string.

public void WriteLineNull(string text, params string[] args)

Parameters

text string

The text to write.

args string[]

Format arguments.

WriteList(List<string>)

Writes all elements of a list, each on a separate line.

public void WriteList(List<string> list)

Parameters

list List<string>

The list to write.

WriteList(string, List<string>)

Writes a labeled list with all elements on separate lines.

public void WriteList(string collectionName, List<string> list)

Parameters

collectionName string

The name/label of the collection.

list List<string>

The list to write.

WriteListOneRow(List<string>, string)

Writes all list elements in a single row separated by a delimiter. Only outputs in DEBUG builds.

public void WriteListOneRow(List<string> list, string separator)

Parameters

list List<string>

The list to write.

separator string

The separator between elements.

WriteNumberedList(string, List<string>, bool)

Writes a numbered or unnumbered list.

public void WriteNumberedList(string label, List<string> list, bool isNumbered)

Parameters

label string

The label/header for the list.

list List<string>

The list to write.

isNumbered bool

Whether to number the list items.