Class GorgonLog
Base class for logging objects.
Inherited Members
Namespace: Gorgon.Diagnostics
Assembly: Gorgon.Core.dll
Syntax
public abstract class GorgonLog : IGorgonThreadedLog, IGorgonLog
Constructors
| Edit this page View SourceGorgonLog(string, Version)
Initializes a new instance of the GorgonLog class.
Declaration
protected GorgonLog(string appName, Version version = null)
Parameters
Type | Name | Description |
---|---|---|
string | appName | File name for the log file. |
Version | version | [Optional] The version of the application that is logging. |
Remarks
This constructor is meant for developers to implement their own logging implementation without having to recreate all functionality in the IGorgonLog interface.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
Fields
| Edit this page View SourceNullLog
An instance of a log that does no logging and merely contains empty methods.
Declaration
public static readonly IGorgonLog NullLog
Field Value
Type | Description |
---|---|
IGorgonLog |
Properties
| Edit this page View SourceLogApplication
Property to return the name of the application that is being logged.
Declaration
public string LogApplication { get; }
Property Value
Type | Description |
---|---|
string |
LogFilterLevel
Property to set or return the filtering level of this log.
Declaration
public LoggingLevel LogFilterLevel { get; set; }
Property Value
Type | Description |
---|---|
LoggingLevel |
Provider
Property to return the provider for this log.
Declaration
public IGorgonLogProvider Provider { get; protected set; }
Property Value
Type | Description |
---|---|
IGorgonLogProvider |
Remarks
Logging implementations that inherit from this class will be able to assign their own provider in the base constructor.
ThreadID
Property to return the ID of the thread that created the log object.
Declaration
public int ThreadID { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceLogEnd()
Function to end logging to the file.
Declaration
public void LogEnd()
LogException(Exception)
Function to send an exception to the log.
Declaration
public void LogException(Exception ex)
Parameters
Type | Name | Description |
---|---|---|
Exception | ex | The exception to log. |
Remarks
If the LogFilterLevel is set to LoggingLevel.NoLogging
, then the exception will not be logged. If the filter is set to any other setting, it will be logged
regardless of filter level.
LogStart()
Function to perform any one time inital logging.
Declaration
public void LogStart()
Remarks
If calling this method from a thread that is not the thread that created the object, then no new file will be created.
Print(string, LoggingLevel, params object[])
Function to print a formatted line of text to the log.
Declaration
public void Print(string formatSpecifier, LoggingLevel level, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
string | formatSpecifier | Format specifier for the line. |
LoggingLevel | level | Level that this message falls under. |
object[] | arguments | List of optional arguments. |