Table of Contents

Class LoggerBaseCl

Namespace
SunamoCl._public.SunamoLogging.Base
Assembly
SunamoCl.dll

Base class for loggers. Other logger classes like DebugLogger are derived from this.

public abstract class LoggerBaseCl
Inheritance
LoggerBaseCl
Derived
Inherited Members
Extension Methods

Constructors

LoggerBaseCl()

Initializes a new instance of the LoggerBaseCl class with no write delegate

protected LoggerBaseCl()

LoggerBaseCl(Action<string, string[]>)

Initializes a new instance of the LoggerBaseCl class with the specified write delegate

public LoggerBaseCl(Action<string, string[]> writeLineDelegate)

Parameters

writeLineDelegate Action<string, string[]>

Delegate used to write formatted output lines

Properties

IsActive

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

public bool IsActive { get; set; }

Property Value

bool

WriteLineDelegate

Gets or sets the delegate used to write formatted lines to output.

protected Action<string, string[]> WriteLineDelegate { get; set; }

Property Value

Action<string, string[]>

Methods

IsInRightFormat(string, params string[])

Checks whether the given text with arguments can be formatted without exceptions

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

Parameters

text string

Format string to test

args string[]

Arguments for the format string

Returns

bool

True if the format is valid, false otherwise

WriteArgs(params string[])

Writes arguments joined by semicolons

public void WriteArgs(params string[] args)

Parameters

args string[]

Arguments to write

WriteCount(string, IList)

Writes the count of items in a collection with the collection name

public void WriteCount(string collectionName, IList list)

Parameters

collectionName string

Name of the collection

list IList

Collection to get the count from

WriteLine(string)

Writes a single line to the output if the text is not null.

public void WriteLine(string text)

Parameters

text string

Text to write.

WriteLine(string, object)

Writes a name-value pair to the output, auto-appending ": " between them.

public void WriteLine(string objectName, object objectValue)

Parameters

objectName string

Name of the object or property.

objectValue object

Value of the object or property.

WriteLine(string, params string[])

Writes a formatted line if the logger is active

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

Parameters

text string

Format string for the message

args string[]

Arguments for the format string

WriteLineFormat(string, params string[])

Writes a formatted line using the write delegate. Kept for backward compatibility.

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

Parameters

formatString string

Format string for the message

args string[]

Arguments for the format string

WriteLineNull(string, params string[])

Writes a formatted line with null-safe text conversion if the logger is active

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

Parameters

text string

Text to write, converted to "(null)" if null

args string[]

Arguments for the format string

WriteList(List<string>)

Writes each item in the list as a separate line

public void WriteList(List<string> list)

Parameters

list List<string>

List of string items to write

WriteList(string, List<string>)

Writes a named list header followed by all elements

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

Parameters

collectionName string

Name of the collection to display as header

list List<string>

List of string elements to write

WriteListOneRow(List<string>, string)

Writes all items in a list joined by a separator on a single row

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

Parameters

items List<string>

Items to join and write

separator string

Separator between items

WriteNumberedList(string, List<string>, bool)

Writes a list with optional numbering and a header

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

Parameters

header string

Header text for the list

list List<string>

List of string items to write

isNumbered bool

Whether to prefix each item with its number