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 =
public class LogManager : object
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();
|
|
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);
|
|
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 |