using System;
namespace ServiceStack.Logging.EventLog
{
///
/// ILogFactory used to create an EventLogger
///
public class EventLogFactory : ILogFactory
{
private readonly string eventLogName;
private readonly string eventLogSource;
///
/// Initializes a new instance of the class.
///
/// Name of the event log.
public EventLogFactory(string eventLogName) : this(eventLogName, null) { }
///
/// Initializes a new instance of the class.
///
/// Name of the event log. Default is 'ServiceStack.Logging.EventLog'
/// The event log source. Default is 'Application'
public EventLogFactory(string eventLogName, string eventLogSource)
{
this.eventLogName = eventLogName ?? "ServiceStack.Logging.EventLog";
this.eventLogSource = eventLogSource ?? "Application";
}
///
/// Gets the logger.
///
/// The type.
///
public ILog GetLogger(Type type)
{
return GetLogger(type.ToString());
}
///
/// Gets the logger.
///
/// Name of the type.
///
public ILog GetLogger(string typeName)
{
return new EventLogger(eventLogName, eventLogSource);
}
}
}