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
Properties
IsActive
Gets or sets whether the logger is active and should write output.
public bool IsActive { get; set; }
Property Value
WriteLineDelegate
Gets or sets the delegate used to write formatted lines to output.
protected Action<string, string[]> WriteLineDelegate { get; set; }
Property Value
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
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
argsstring[]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
WriteLine(string)
Writes a single line to the output if the text is not null.
public void WriteLine(string text)
Parameters
textstringText 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
objectNamestringName of the object or property.
objectValueobjectValue 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
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
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
textstringText to write, converted to "(null)" if null
argsstring[]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
WriteList(string, List<string>)
Writes a named list header followed by all elements
public void WriteList(string collectionName, List<string> list)
Parameters
collectionNamestringName of the collection to display as header
listList<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
WriteNumberedList(string, List<string>, bool)
Writes a list with optional numbering and a header
public void WriteNumberedList(string header, List<string> list, bool isNumbered)