Class ServiceBase
Main base class for most services which have Logs.
[InternalApi_DoNotUse_MayChangeWithoutNotice]
public abstract class ServiceBase : IHasLog
- Inheritance
-
objectServiceBase
- Implements
- Derived
Remarks
This is quite internal but used heavily. If you are creating DLLs using 2sxc, this may be a good choice, just remember to check if this changes in future versions.
Notes
- Also has an API to auto-connect the logs of child-services.
Constructors
ServiceBase(string, NoParamOrder, object[]?)
Main constructor.
protected ServiceBase(string logName, NoParamOrder npo = default, object[]? connect = null)
Parameters
logNamestringThe name to use in the log, like "My.Purpose"
npoNoParamOrderconnectobject[]List of services to auto-connect to the logging.
Methods
ConnectLogs(object[])
Connect Log of all dependencies listed in the services array.
protected void ConnectLogs(object[] services)
Parameters
servicesobject[]One or more services which could implement ToSic.Sys.DI.ILazyInitLog or IHasLog