RegisterLogger
This method allows the user to add a logger to Mapzania for a preferred logging platform (e.g. NLog or log4net).
NOTE: This method can be called multiple times, should you want to register more than one logger class.
Mapzania generates a number of logs namely:
- Error Log - Exceptions are logged to this log
- Debug Log - Detailed debugging information is logged to this log
- Message Log - Messages relating to service events are logged to this log
- Custom Logs - A number of custom events are logged to these logs. These include events such as WebApi calls, Metrics and Usage.
NOTE: See Adding Logging Services for an example of a logger implementation.
Parameters
Name | Required | Type | Description |
---|---|---|---|
logger | Yes | Mapzania.Logging.ILogger | The concrete implementation of a logger created by the user. |
Example
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
var logPath = @"c:\logs";
var logger = new NLogLogger(logPath);
Mapzania.Services.RegisterLogger(logger);
var logger2 = new Log4NetLogger();
Mapzania.Services.RegisterLogger(logger2);
Mapzania.Services.Start(this);
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}