Show / Hide Table of Contents

Class SoLogger

Summary description for SoLogger.

Inheritance
object
SoLogger
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: SuperOffice.Diagnostics
Assembly: SoCore.dll
Syntax
public sealed class SoLogger

Constructors

SoLogger(ILoggerFactory, IServiceProvider)

Dependency injection constructor.

Declaration
public SoLogger(ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
Parameters
Type Name Description
ILoggerFactory loggerFactory

Logger factory ready to make new loggers on demand

IServiceProvider serviceProvider

Properties

Logger

Get the singleton instance of the logger class

Declaration
public static SoLogger Logger { get; }
Property Value
Type Description
SoLogger

Methods

BeginScope(string, string, params object[])

Open a logging scope

Declaration
public static IDisposable BeginScope(string category, string message, params object[] args)
Parameters
Type Name Description
string category
string message

Summary message

object[] args

Details for message

Returns
Type Description
IDisposable

Disposable scope. Dispose to close scope.

BeginScope<T>(string, params object[])

Open a logging scope

Declaration
public static IDisposable BeginScope<T>(string message, params object[] args)
Parameters
Type Name Description
string message

Summary message

object[] args

Details for message

Returns
Type Description
IDisposable

Disposable scope. Dispose to close scope.

Type Parameters
Name Description
T

Count(string, Dictionary<string, double>)

Count a multiple values

Declaration
public static void Count(string eventName, Dictionary<string, double> metrics)
Parameters
Type Name Description
string eventName
Dictionary<string, double> metrics

Count(string, NameValueCollection, Dictionary<string, double>)

Count a multiple values

Declaration
public static void Count(string eventName, NameValueCollection env, Dictionary<string, double> metrics)
Parameters
Type Name Description
string eventName
NameValueCollection env
Dictionary<string, double> metrics

Count(string, NameValueCollection, params (string, double)[])

Count a multiple values

Declaration
public static void Count(string eventName, NameValueCollection env, params (string, double)[] pairs)
Parameters
Type Name Description
string eventName
NameValueCollection env
(string, double)[] pairs

Count(string, string, double)

Count a single value

Declaration
public static void Count(string eventName, string counterName, double counterValue)
Parameters
Type Name Description
string eventName
string counterName
double counterValue

Count(string, params string[])

Count 1 for these names.

Declaration
public static void Count(string eventName, params string[] counterNames)
Parameters
Type Name Description
string eventName
string[] counterNames

Count(string, params (string, double)[])

Count a multiple values without having to construct a dictionary first

Declaration
public static void Count(string eventName, params (string, double)[] pairs)
Parameters
Type Name Description
string eventName
(string, double)[] pairs

GetEnvironmentInfo()

Get a name/value collection of environmental information, from all subscribers to our event. Also add any hard-set additional values.

Declaration
public NameValueCollection GetEnvironmentInfo()
Returns
Type Description
NameValueCollection

GetLogger(string)

Summary description for SoLogger.

Declaration
public ILogger GetLogger(string categoryName)
Parameters
Type Name Description
string categoryName
Returns
Type Description
ILogger

GetLogger(Type)

Summary description for SoLogger.

Declaration
public ILogger GetLogger(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
ILogger

GetLogger<T>()

Summary description for SoLogger.

Declaration
public ILogger<T> GetLogger<T>()
Returns
Type Description
ILogger<T>
Type Parameters
Name Description
T

LogCritical<T>(Exception, string, params object[])

Create and log an event of type Critical to the logging system.

Declaration
public static void LogCritical<T>(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception

Exception being thrown

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

Type Parameters
Name Description
T

LogCritical<T>(string, params object[])

Create and log an event of type Critical to the logging system.

Declaration
public static void LogCritical<T>(string message, params object[] args)
Parameters
Type Name Description
string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

Type Parameters
Name Description
T

LogDebug(string, string, params object[])

Create and log an event of type Debug to the logging system.

Declaration
public static void LogDebug(string categoryName, string message, params object[] args)
Parameters
Type Name Description
string categoryName

Log category - usually the type name

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogDebug<T>(Exception, string, params object[])

Create and log an event of type Debug to the logging system.

Declaration
public static void LogDebug<T>(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception

Exception being thrown

string message

Summary message

object[] args

Details for message

Type Parameters
Name Description
T

LogDebug<T>(string, params object[])

Create and log an event of type Debug to the logging system.

Declaration
public static void LogDebug<T>(string message, params object[] args)
Parameters
Type Name Description
string message

Summary message

object[] args

Parameters to message

Type Parameters
Name Description
T

LogError(string, string, params object[])

Create and log an event of type Error to the logging system.

Declaration
public static void LogError(string categoryName, string message, params object[] args)
Parameters
Type Name Description
string categoryName

Log category - usually the type name

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogError<T>(Exception, string, params object[])

Create and log an event of type Error to the logging system.

Declaration
public static void LogError<T>(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception

Exception being thrown

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

Type Parameters
Name Description
T

LogError<T>(string, params object[])

Create and log an event of type Error to the logging system.

Declaration
public static void LogError<T>(string message, params object[] args)
Parameters
Type Name Description
string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

Type Parameters
Name Description
T

LogException(EventLogEntryType, Exception, bool)

Log an exception. Logging will be done to a log file, debugger trace, and SuperOffice crash log service depending on the options set in the config file.

Declaration
[Obsolete("Use LogError<T>(ex) instead", false)]
public void LogException(EventLogEntryType logType, Exception exception, bool lightLogOutput = false)
Parameters
Type Name Description
EventLogEntryType logType
Exception exception
bool lightLogOutput

LogExceptionError(string, Exception, string, params object[])

Create and log an event of type Error to the logging system.

Declaration
public static void LogExceptionError(string categoryName, Exception exception, string message, params object[] args)
Parameters
Type Name Description
string categoryName

Log category - usually the type name

Exception exception
string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogExceptionError<T>(Exception, string, params object[])

Summary description for SoLogger.

Declaration
public static void LogExceptionError<T>(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception
string message
object[] args
Type Parameters
Name Description
T

LogExceptionWarning(string, Exception, string, params object[])

Create and log an event of type Warning to the logging system.

Declaration
public static void LogExceptionWarning(string categoryName, Exception exception, string message, params object[] args)
Parameters
Type Name Description
string categoryName

Log category - usually the type name

Exception exception
string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogFailure(Exception, string, params object[])

Create and log an event of type Error to the logging system, tagged as FailureAudit.

Declaration
public static void LogFailure(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception

Exception being thrown

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogInformation(string, string, params object[])

Create and log an event of type Information to the logging system.

Declaration
public static void LogInformation(string categoryName, string message, params object[] args)
Parameters
Type Name Description
string categoryName

Log category - usually the type name

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogInformation<T>(Exception, string, params object[])

Create and log an event of type Information to the logging system.

Declaration
public static void LogInformation<T>(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception

Exception being thrown

string message

Summary message

object[] args

Details for message

Type Parameters
Name Description
T

LogInformation<T>(string, params object[])

Create and log an event of type Information to the logging system.

Declaration
public static void LogInformation<T>(string message, params object[] args)
Parameters
Type Name Description
string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

Type Parameters
Name Description
T

LogSuccess(Exception, string, params object[])

Create and log an event of type Information to the logging system, tagged as SuccessAudit.

Declaration
public static void LogSuccess(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception

Exception being thrown

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogTrace(string, string, params object[])

Create and log an event of type Trace to the logging system.

Declaration
public static void LogTrace(string categoryName, string message, params object[] args)
Parameters
Type Name Description
string categoryName

Log category - usually the type name

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogTrace<T>(string, params object[])

Create and log an event of type Trace to the logging system.

Declaration
public static void LogTrace<T>(string message, params object[] args)
Parameters
Type Name Description
string message

Log message, including {placeholders} for arguments.

object[] args
Type Parameters
Name Description
T

LogWarning(string, string, params object[])

Create and log an event of type Warning to the logging system.

Declaration
public static void LogWarning(string categoryName, string message, params object[] args)
Parameters
Type Name Description
string categoryName

Log category - usually the type name

string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

LogWarning<T>(Exception, string, params object[])

Create and log an event of type Warning to the logging system.

Declaration
public static void LogWarning<T>(Exception exception, string message, params object[] args)
Parameters
Type Name Description
Exception exception

Exception being thrown

string message

Summary message

object[] args

Details for message

Type Parameters
Name Description
T

LogWarning<T>(string, params object[])

Create and log an event of type Warning to the logging system.

Declaration
public static void LogWarning<T>(string message, params object[] args)
Parameters
Type Name Description
string message

Log message, including {placeholders} for arguments.

object[] args

Parameters to message

Type Parameters
Name Description
T

PopulateEnvironmentInfo(LogEntryInfo)

Populate environment information for a log entry.

Declaration
public void PopulateEnvironmentInfo(LogEntryInfo entry)
Parameters
Type Name Description
LogEntryInfo entry

The entry to populate environment information on.

PopulateEnvironmentInfo(NameValueCollection)

Populate environment information for a log entry.

Declaration
public void PopulateEnvironmentInfo(NameValueCollection values)
Parameters
Type Name Description
NameValueCollection values

Collection to hold the values.

SetPermanentAdditionalValue(string, string)

Set one named value to be added to any logged events. This name/value will remain valid until manually reset or changed.

Declaration
public static void SetPermanentAdditionalValue(string name, string value)
Parameters
Type Name Description
string name

Name of item

string value

Value of item

SetPermanentAdditionalValues(string[], string[])

Set an array of named values to be added to any logged events. These names/values will remain valid until manually reset or changed.

Declaration
public static void SetPermanentAdditionalValues(string[] names, string[] values)
Parameters
Type Name Description
string[] names

Names of items

string[] values

Values of items

StartOperation(string, IDictionary<string, string>)

Log an operation with properties

Declaration
public static IDisposable StartOperation(string operationname, IDictionary<string, string> args)
Parameters
Type Name Description
string operationname

Name of operation being traced

IDictionary<string, string> args

Additional string key/values to add to trace

Returns
Type Description
IDisposable

an operation tracer. Dispose it to signal end of operation

StartOperation(string, params string[])

Log an operation

Declaration
public static IDisposable StartOperation(string operationname, params string[] args)
Parameters
Type Name Description
string operationname

Name of operation being traced

string[] args

Additional strings to add to trace (optional)

Returns
Type Description
IDisposable

an operation tracer. Dispose it to signal end of operation

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top