The LogManager provides the top level access to the log and is the public facing interface to the log. It uses an underlying ILogProvider implementation to write to the appropriate log store. which includes Sql Server, Text File, Xml File or EventLog (and can be extended with your own providers)
To use you'll need to create an instance of the LogProvider once can call the static Create method. From then on in you can always use the LogManager.Current instance to access features of the logging engine.
To set up (Application_Start // Specify Sql Log with a Connection string or ConnectionString Config Entry Name LogManager.Create( new SqlLogAdapter("WestWindAdmin") );
To access log features: LogEntry entry = new LogEntry(); entry.Message = "Application started..."; entry.ErrorLevel =
Westwind.Utilities.Logging.LogManager
public class LogManager : object
Class Members
Member | Description | |
---|---|---|
Constructor |
Main signature allows creating of manager with an adapter to specify logging target | |
Clear |
Clears out all the entries in the log public bool Clear() public bool Clear(int countToLeave) |
|
Create |
Creates an instance of a log Manager and attaches it to the static Current property that is reusable throughout the application. public static LogManager Create(ILogAdapter adapter) public static LogManager Create(LogAdapterTypes logType) public static LogManager Create() |
|
CreateLog |
Creates a new Log table/file/log depending on the provider. Check provider documentation on requirements for 'connections' or locations for logs. public bool CreateLog() |
|
DeleteLog |
Deletes the Log completely by removing the table/file/log public bool DeleteLog() |
|
GetEntries |
public IEnumerable |
|
GetEntryCount |
Returns count of all entries for a given error level. public int GetEntryCount(ErrorLevels errorLevel) |
|
GetWebLogEntry |
Retrieves an individual log entry if possible. Depending on the implementation of the log log entries may not be retrievable individually (for example from a text log) or the event log. public WebLogEntry GetWebLogEntry(int id) |
|
Log |
Writes a Web specific log entry into the log public bool Log(WebLogEntry entry, bool logHttpInfo) |
|
LogError |
Writes an Error message entry to the log public bool LogError(string message, string details, string stackTrace) public bool LogError(Exception ex, bool logHttpInfo) |
|
LogInfo |
Writes an Info entry into the log public bool LogInfo(string message, string details, string stackTrace, bool logHttpInfo) |
|
LogWarning |
Writes a warning message to the log public bool LogWarning(string message, string details, string stackTrace, bool logHttpInfo) |
|
WriteEntry |
Writes a Web specific log entry into the log public bool WriteEntry(WebLogEntry entry) |
|
Current |
Static instance of the log manager. Used so you can configure the log manager once and easily reuse it in an application | |
LogAdapter |
Global instance of the LogAdapter used |
Requirements
Namespace: Westwind.Utilities.LoggingAssembly: westwind.utilities.dll
© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic