Provides application-wide access to the currently configured Logging engine.
Namespace:
Phoenix.UtilitiesAssembly: Phoenix.Utilities (in Phoenix.Utilities.dll) Version: 2.9.3209.25656 (2.9.0.0)
Syntax
| C# |
|---|
public static class PhoenixLog |
Remarks
This static class maintains one-and-only-one instance of a class that implements the ILog
interface. An instance is first created by calling the Create(String, LogArchiveType, Int64) method. Once created, the
AddEntry(String, array<Object>[]()[]) and AddError(Exception) methods can be used to write to the log.
The following pseudo-code shows how a logger is typically used.
CopyC#
PhoenixLog.Create("c:\mylogfile.xml", LogArchiveType.Daily, 0); . . . PhoenixLog.AddEntry("Hello world!");
Examples
This example shows how the logger is used in real life.
CopyC#
protected void Application_Start(object sender, EventArgs e) { // Code that runs when the application starts PhoenixLog.Create(PhoenixConfiguration.GetLogFilePath(), PhoenixConfiguration.LogArchiveMethod, PhoenixConfiguration.LogArchiveValue); SomeMethod(); } private void SomeMethod() { try { int n = 42; int d = 0; int result = n / d; } catch (DivideByZeroException ex) { PhoenixLog.AddError("You divided by zero bonehead", ex); } }
