Gorgon
Show / Hide Table of Contents

Class GorgonLog

Base class for logging objects.

Inheritance
object
GorgonLog
GorgonLogConsole
GorgonTextFileLog
Implements
IGorgonThreadedLog
IGorgonLog
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Diagnostics
Assembly: Gorgon.Core.dll
Syntax
public abstract class GorgonLog : IGorgonThreadedLog, IGorgonLog

Constructors

| Edit this page View Source

GorgonLog(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 appName parameter is null.

ArgumentEmptyException

Thrown when the appName parameter is empty.

Fields

| Edit this page View Source

NullLog

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 Source

LogApplication

Property to return the name of the application that is being logged.

Declaration
public string LogApplication { get; }
Property Value
Type Description
string
| Edit this page View Source

LogFilterLevel

Property to set or return the filtering level of this log.

Declaration
public LoggingLevel LogFilterLevel { get; set; }
Property Value
Type Description
LoggingLevel
| Edit this page View Source

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.

| Edit this page View Source

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 Source

LogEnd()

Function to end logging to the file.

Declaration
public void LogEnd()
| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

Implements

IGorgonThreadedLog
IGorgonLog

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author