Sphyrnidae Common Library
2.0.1
Shared Utilities/Library
|
Implementation of logging More...
Public Member Functions | |
Logger (ILoggerConfiguration config, ILoggers loggers, IServiceProvider provider, IAlert alert, LongRunningInformation longRunningInfo, HttpResponseInformation httpResponseInfo, IApplicationSettings app, IEmail email) | |
Note that I'm only injecting ILoggerConfiguration, and all the others are being looked up via Service Locator. This seemed like an easier pattern to use instead of having a large interface listing into constructor More... | |
virtual void | Generic (BaseLogInformation info, Action errorAction=null) |
virtual void | Entry (TimerBaseInformation info, Action errorAction=null) |
virtual void | Exit (TimerBaseInformation info, Action errorAction=null) |
virtual void | Log (TraceEventType severity, string message, string category="") |
Logs a generic message More... | |
virtual void | Unauthorized (string message) |
Logs an unauthorized access to the system More... | |
virtual TimerInformation | TimerStart (string name) |
Will log how long the enclosed action took (from TimerStart to TimerEnd) More... | |
virtual void | TimerEnd (TimerInformation info) |
Logs the actual time an operation lasted (in milliseconds) More... | |
virtual void | Custom1< T > (T obj, string message="") |
Logs a generic object More... | |
virtual void | Custom2< T > (T obj, string message="") |
Logs a generic object More... | |
virtual void | Custom3< T > (T obj, string message="") |
Logs a generic object More... | |
virtual CustomTimerInformation1< T1, T2 > | CustomTimer1Start< T1, T2 > (T1 obj, string message="") |
Will log a custom timer object More... | |
virtual CustomTimerInformation2< T1, T2 > | CustomTimer2Start< T1, T2 > (T1 obj, string message="") |
Will log a custom timer object More... | |
virtual CustomTimerInformation3< T1, T2 > | CustomTimer3Start< T1, T2 > (T1 obj, string message="") |
Will log a custom timer object More... | |
virtual void | CustomTimerEnd< T1, T2 > (CustomTimerInformation< T1, T2 > info, T2 obj) |
Logs the actual time a custom timer took (in milliseconds) More... | |
virtual AttributeInformation | AttributeEntry (string attributeName, Dictionary< string, string > parameters) |
Will log an Attribute call More... | |
virtual void | AttributeExit (AttributeInformation info) |
Logs the actual time the attribute took (in milliseconds), as well as the result More... | |
virtual async Task< ApiInformation > | ApiEntry () |
Will log all configurable information about an API call More... | |
virtual void | ApiExit (ApiInformation info, int statusCode, string result) |
Logs the actual time API took (in milliseconds), as well as the result More... | |
virtual async Task | ApiExit (ApiInformation info, HttpResponse response) |
Logs the actual time API took (in milliseconds), as well as the result More... | |
virtual DatabaseInformation | DatabaseEntry (string cnnName, string command, object args=null) |
Will log all configurable information about a database call More... | |
virtual void | DatabaseExit (DatabaseInformation info) |
Logs the actual time the database call took (in milliseconds) More... | |
virtual WebServiceInformation | WebServiceEntry (HttpHeaders headers, string name, string url, string method, object data=null) |
Will log all configurable information about a web service call More... | |
virtual void | WebServiceExit (WebServiceInformation info, int statusCode, string result) |
Logs the actual time the web service call took (in milliseconds), and optionally the result More... | |
virtual async Task | WebServiceExit (WebServiceInformation info, HttpResponseMessage response) |
Logs the actual time the web service call took (in milliseconds), and optionally the result More... | |
virtual MiddlewareInformation | MiddlewareEntry (string name) |
Will log information about a middleware component More... | |
virtual void | MiddlewareExit (MiddlewareInformation info) |
Logs the actual time the middleware took (in milliseconds) More... | |
virtual void | HiddenException (Exception e, bool messageOnly) |
Will log all hidden exception information More... | |
virtual void | HiddenException (Exception e, string title="", bool messageOnly=true) |
Will log all hidden exception information More... | |
virtual Guid | Exception (Exception e, bool messageOnly) |
Will log all exception information More... | |
virtual Guid | Exception (Exception e, string title="", bool messageOnly=false) |
Will log all exception information More... | |
Protected Member Functions | |
void | DoLog (BaseLogInformation info, Action errorAction=null) |
void | DoUpdate (TimerBaseInformation info, Action errorAction=null) |
Properties | |
ILoggerConfiguration | Config [get] |
ILoggers | Loggers [get] |
IServiceProvider | Provider [get] |
IAlert | Alert [get] |
LongRunningInformation | LongRunningInfo [get] |
HttpResponseInformation | HttpResponseInfo [get] |
IApplicationSettings | App [get] |
IEmail | EmailImpl [get] |
Implementation of logging
All calls will be handled asynchronously and the actual logging occurs in this class
Sphyrnidae.Common.Logging.Logger.Logger | ( | ILoggerConfiguration | config, |
ILoggers | loggers, | ||
IServiceProvider | provider, | ||
IAlert | alert, | ||
LongRunningInformation | longRunningInfo, | ||
HttpResponseInformation | httpResponseInfo, | ||
IApplicationSettings | app, | ||
IEmail | |||
) |
Note that I'm only injecting ILoggerConfiguration, and all the others are being looked up via Service Locator. This seemed like an easier pattern to use instead of having a large interface listing into constructor
|
virtual |
Will log all configurable information about an API call
Call this method when first entering an API method The actual information that is collected (or if this even logs out) will be given by your implementation of ILoggerConfiguration/ApiInformation
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time API took (in milliseconds), as well as the result
This should be called after ApiEntry
info | The object with the api information which was returned from ApiEntry |
response | The HttpResponse object |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time API took (in milliseconds), as well as the result
This should be called after ApiEntry
info | The object with the api information which was returned from ApiEntry |
statusCode | The http status code of the result |
result | The full http result |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log an Attribute call
Call this method when first entering an attribute
attributeName | The name of the attribute |
parameters | The parameters into the attribute |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time the attribute took (in milliseconds), as well as the result
This should be called after AttributeEntry
info | The object with the attribute information which was returned from AttributeEntry |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs a generic object
To use this, you should create a class inheriting from CustomInformation1. Fill out all of the required abstract methods (and override any others) You will need to register this service: Eg. services.TryAddTransient<CustomInformation1<Widget>, WidgetInformation>(); When you call this method, the type needs to match... otherwise runtime exception with service locator.
obj | Your object to be logged |
message | Optional message to be logged (if not supplied in your inherited class) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs a generic object
To use this, you should create a class inheriting from CustomInformation2. Fill out all of the required abstract methods (and override any others) You will need to register this service: Eg. services.TryAddTransient<CustomInformation2<Widget>, WidgetInformation>(); When you call this method, the type needs to match... otherwise runtime exception with service locator.
obj | Your object to be logged |
message | Optional message to be logged (if not supplied in your inherited class) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs a generic object
To use this, you should create a class inheriting from CustomInformation3. Fill out all of the required abstract methods (and override any others) You will need to register this service: Eg. services.TryAddTransient<CustomInformation3<Widget>, WidgetInformation>(); When you call this method, the type needs to match... otherwise runtime exception with service locator.
obj | Your object to be logged |
message | Optional message to be logged (if not supplied in your inherited class) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log a custom timer object
To use this, you should create a class inheriting from CustomTimerInformation1. Fill out all of the required abstract methods (and override any others) You will need to register this service: Eg. services.TryAddTransient<CustomTimerInformation1<Widget, Foo>, WidgetTimerInformation>(); When you call this method, the type needs to match... otherwise runtime exception with service locator.
obj | Your object to be logged |
message | Optional message to be logged (if not supplied in your inherited class) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log a custom timer object
To use this, you should create a class inheriting from CustomTimerInformation2. Fill out all of the required abstract methods (and override any others) You will need to register this service: Eg. services.TryAddTransient<CustomTimerInformation2<Widget, Foo>, WidgetTimerInformation>(); When you call this method, the type needs to match... otherwise runtime exception with service locator.
obj | Your object to be logged |
message | Optional message to be logged (if not supplied in your inherited class) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log a custom timer object
To use this, you should create a class inheriting from CustomTimerInformation3. Fill out all of the required abstract methods (and override any others) You will need to register this service: Eg. services.TryAddTransient<CustomTimerInformation3<Widget, Foo>, WidgetTimerInformation>(); When you call this method, the type needs to match... otherwise runtime exception with service locator.
obj | Your object to be logged |
message | Optional message to be logged (if not supplied in your inherited class) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time a custom timer took (in milliseconds)
This should be called after CustomTimerStart
info | The object with the timer which was returned from CustomTimerStart |
obj | Any object to store additional user-supplied information |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log all configurable information about a database call
Call this method right before making a call to a database The actual information that is collected (or if this even logs out) will be given by your implementation of ILoggerConfiguration/DatabaseInformation
cnnName | The "nice" name for which database/connection you are using (don't include sensitive information) |
command | The command being executed |
args | Any parameters for the command |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time the database call took (in milliseconds)
This should be called after DatabaseEntry
info | The object with the database information which was returned from DatabaseEntry |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
protected |
|
protected |
|
virtual |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log all exception information
Call this method whenever an exception has occurred that has stopped processing of the request The actual information that is collected (or if this even logs out) will be given by your implementation of ILoggerConfiguration/ExceptionInformation
e | The exception that was thrown |
messageOnly | Optional. Default = true If true, this will only log the exception text and type If false, all relevant information will be logged (eg. Stack Trace) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log all exception information
Call this method whenever an exception has occurred that has stopped processing of the request The actual information that is collected (or if this even logs out) will be given by your implementation of ILoggerConfiguration/ExceptionInformation
e | The exception that was thrown |
title | The type of exception, or a "nice" name you are giving this |
messageOnly | Optional. Default = true If true, this will only log the exception text and type If false, all relevant information will be logged (eg. Stack Trace) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log all hidden exception information
Call this method whenever an exception has occurred that will be ignored The actual information that is collected (or if this even logs out) will be given by your implementation of ILoggerConfiguration/ExceptionInformation
ex | The exception that is being hidden |
messageOnly | Optional. Default = true If true, this will only log the exception text and type If false, all relevant information will be logged (eg. Stack Trace) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log all hidden exception information
Call this method whenever an exception has occurred that will be ignored The actual information that is collected (or if this even logs out) will be given by your implementation of ILoggerConfiguration/ExceptionInformation
ex | The exception that is being hidden |
title | The type of exception, or a "nice" name you are giving this |
messageOnly | Optional. Default = true If true, this will only log the exception text and type If false, all relevant information will be logged (eg. Stack Trace) |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs a generic message
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log information about a middleware component
name | The name of the middleware component |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time the middleware took (in milliseconds)
info | The object with the middleware information which was returned from MiddlewareEntry |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time an operation lasted (in milliseconds)
This should be called after TimerStart
info | The object with the timer which was returned from TimerStart |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log how long the enclosed action took (from TimerStart to TimerEnd)
Call this function at any place in your code where you want to capture helpful timing information
name | The name you are giving this timer |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs an unauthorized access to the system
This should be called on your authentication/authorization checks if they fail
message | The message to log |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Will log all configurable information about a web service call
Call this method right before making a web service call The actual information that is collected (or if this even logs out) will be given by your implementation of ILoggerConfiguration/WebServiceInformation
headers | The collection of HTTP headers that will have logger prefix added |
name | The unique name of the route you are hitting |
url | The endpoint that is being hit |
method | The HTTP method: GET POST PUT DELETE OTHER |
data | Any additional data being sent in the body of the request |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time the web service call took (in milliseconds), and optionally the result
This should be called after WebServiceEntry
info | The object with the web service information which was returned from WebServiceEntry |
response | The result from the web service call |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
virtual |
Logs the actual time the web service call took (in milliseconds), and optionally the result
This should be called after WebServiceEntry
info | The object with the web service information which was returned from WebServiceEntry |
statusCode | The http status code of the result |
result | The full http result |
Implements Sphyrnidae.Common.Logging.Interfaces.ILogger.
|
getprotected |
|
getprotected |
|
getprotected |
|
getprotected |
|
getprotected |
|
getprotected |
|
getprotected |
|
getprotected |