本文整理汇总了C#中ILoggerFactory.GetCurrentClassLogger方法的典型用法代码示例。如果您正苦于以下问题:C# ILoggerFactory.GetCurrentClassLogger方法的具体用法?C# ILoggerFactory.GetCurrentClassLogger怎么用?C# ILoggerFactory.GetCurrentClassLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILoggerFactory
的用法示例。
在下文中一共展示了ILoggerFactory.GetCurrentClassLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MigrateForm
public MigrateForm(
string sourceRootPath,
string sourceServerUrl,
string destinationRootPath,
string destinationServerUrl,
IReportServerReader reader,
IReportServerWriter writer,
ILoggerFactory loggerFactory)
{
if (string.IsNullOrEmpty(sourceRootPath))
throw new ArgumentException("sourceRootPath");
if (string.IsNullOrEmpty(sourceServerUrl))
throw new ArgumentException("sourceServerUrl");
if (string.IsNullOrEmpty(destinationServerUrl))
throw new ArgumentException("destinationServerUrl");
if (string.IsNullOrEmpty(sourceServerUrl))
throw new ArgumentException("sourceServerUrl");
if (reader == null)
throw new ArgumentNullException("reader");
if (writer == null)
throw new ArgumentNullException("writer");
if (loggerFactory == null)
throw new ArgumentNullException("loggerFactory");
InitializeComponent();
this.mSourceRootPath = sourceRootPath;
this.mSourceServerUrl = sourceServerUrl;
this.mDestinationRootPath = destinationRootPath;
this.mDestinationServerUrl = destinationServerUrl;
this.mReportServerReader = reader;
this.mReportServerWriter = writer;
this.mLoggerFactory = loggerFactory;
this.mLogger = mLoggerFactory.GetCurrentClassLogger();
this.mLogger.Info("sourceRootPath: {0}", this.mSourceRootPath);
this.mLogger.Info("sourceServerUrl: {0}", this.mSourceServerUrl);
this.mLogger.Info("destinationRootPath: {0}", this.mDestinationRootPath);
this.mLogger.Info("destinationServerUrl: {0}", this.mDestinationServerUrl);
this.mSummaryForm = new SummaryForm();
}
示例2: ExportDiskForm
public ExportDiskForm(string sourceRootPath,
string destinationPath,
IReportServerReader reader,
FolderItemExporter folderExporter,
ReportItemExporter reportExporter,
DataSourceItemExporter dataSourceExporter,
ILoggerFactory loggerFactory)
{
if (string.IsNullOrEmpty(sourceRootPath))
throw new ArgumentException("sourceRootPath");
if (string.IsNullOrEmpty(destinationPath))
throw new ArgumentException("destinationPath");
if (reader == null)
throw new ArgumentNullException("reader");
if (folderExporter == null)
throw new ArgumentNullException("folderExporter");
if (reportExporter == null)
throw new ArgumentNullException("reportExporter");
if (dataSourceExporter == null)
throw new ArgumentNullException("dataSourceExporter");
if (loggerFactory == null)
throw new ArgumentNullException("loggerFactory");
InitializeComponent();
this.mSourceRootPath = sourceRootPath;
this.mExportDestinationPath = destinationPath;
this.mReportServerReader = reader;
this.mFolderExporter = folderExporter;
this.mReportExporter = reportExporter;
this.mDataSourceExporter = dataSourceExporter;
this.mLoggerFactory = loggerFactory;
this.mLogger = mLoggerFactory.GetCurrentClassLogger();
this.mSummaryForm = new SummaryForm();
}
示例3: LogFilterAttribute
public LogFilterAttribute(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.GetCurrentClassLogger();
}
示例4: ObjectWithNamedLoggers
// ReSharper disable SuggestBaseTypeForParameter
public ObjectWithNamedLoggers(ILoggerFactory loggerFactory)
// ReSharper restore SuggestBaseTypeForParameter
{
_firstLogger = loggerFactory.GetLogger(this.GetType(), "First");
_secondLogger = loggerFactory.GetCurrentClassLogger("Second");
}
示例5: Initialize
/// <summary>
/// Initializes the bootstrap with the configuration, config resolver and log factory.
/// </summary>
/// <param name="serverConfigResolver">The server config resolver.</param>
/// <param name="loggerFactory">The logger factory.</param>
/// <returns></returns>
public virtual bool Initialize(Func<IServerConfig, IServerConfig> serverConfigResolver, ILoggerFactory loggerFactory)
{
if (m_Initialized)
throw new Exception("The server had been initialized already, you cannot initialize it again!");
if (loggerFactory != null && !string.IsNullOrEmpty(m_Config.LoggerFactory))
{
throw new ArgumentException("You cannot pass in a logFactory parameter, if you have configured a root log factory.", "loggerFactory");
}
if(loggerFactory == null)
{
loggerFactory = GetBootstrapLoggerFactory(m_Config.LoggerFactory);
}
m_GlobalLog = loggerFactory.GetCurrentClassLogger();
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
m_AppServers = new List<IManagedApp>(m_Config.Servers.Count());
IManagedApp serverManager = null;
//Initialize servers
foreach (var config in m_Config.Servers)
{
var serverConfig = config;
if (serverConfigResolver != null)
serverConfig = serverConfigResolver(config);
IManagedApp appServer;
try
{
var serverType = serverConfig.ServerType;
if(string.IsNullOrEmpty(serverType) && !string.IsNullOrEmpty(serverConfig.ServerTypeName))
{
var serverTypeProvider = m_Config.ServerTypes.FirstOrDefault(
t => t.Name.Equals(serverConfig.ServerTypeName, StringComparison.OrdinalIgnoreCase));
if (serverTypeProvider != null)
serverType = serverTypeProvider.Type;
}
if (string.IsNullOrEmpty(serverType))
throw new Exception("No server type configured or the configured server type was not found.");
appServer = CreateWorkItemInstance(serverType);
var serverMetadata = appServer.GetAppServerMetadata();
if (serverMetadata.IsServerManager)
serverManager = appServer;
if (m_GlobalLog.IsDebugEnabled)
m_GlobalLog.DebugFormat("The server instance {0} has been created!", serverConfig.Name);
}
catch (Exception e)
{
if (m_GlobalLog.IsErrorEnabled)
m_GlobalLog.Error(string.Format("Failed to create server instance {0}!", serverConfig.Name), e);
return false;
}
var exceptionSource = appServer as IExceptionSource;
if(exceptionSource != null)
exceptionSource.ExceptionThrown += new EventHandler<ErrorEventArgs>(exceptionSource_ExceptionThrown);
var setupResult = false;
try
{
setupResult = SetupWorkItemInstance(appServer, serverConfig);
if (m_GlobalLog.IsDebugEnabled)
m_GlobalLog.DebugFormat("The server instance {0} has been initialized!", appServer.Name);
}
catch (Exception e)
{
m_GlobalLog.Error(e);
setupResult = false;
}
if (!setupResult)
{
if (m_GlobalLog.IsErrorEnabled)
m_GlobalLog.Error("Failed to setup server instance!");
return false;
}
//.........这里部分代码省略.........
示例6: DefaultBootstrap
/// <summary>
/// Initializes a new instance of the <see cref="DefaultBootstrap"/> class.
/// </summary>
/// <param name="rootConfig">The root config.</param>
/// <param name="appServers">The app servers.</param>
/// <param name="loggerFactory">The logger factory.</param>
public DefaultBootstrap(IRootConfig rootConfig, IEnumerable<IManagedApp> appServers, ILoggerFactory loggerFactory)
{
if (rootConfig == null)
throw new ArgumentNullException("rootConfig");
if (appServers == null)
throw new ArgumentNullException("appServers");
if(!appServers.Any())
throw new ArgumentException("appServers must have one item at least", "appServers");
if (loggerFactory == null)
throw new ArgumentNullException("logFactory");
m_RootConfig = rootConfig;
SetDefaultCulture(rootConfig);
m_AppServers = appServers.ToList();
m_GlobalLog = loggerFactory.GetCurrentClassLogger();
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
if (!rootConfig.DisablePerformanceDataCollector)
{
m_PerfMonitor = new PerformanceMonitor(rootConfig, m_AppServers, null, loggerFactory);
if (m_GlobalLog.IsDebugEnabled)
m_GlobalLog.Debug("The PerformanceMonitor has been initialized!");
}
if (m_GlobalLog.IsDebugEnabled)
m_GlobalLog.Debug("The Bootstrap has been initialized!");
m_Initialized = true;
}
示例7: AccountController
public AccountController(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.GetCurrentClassLogger();
}
示例8: TeacherController
public TeacherController(ITeacherRepository employeeRepository, ILoggerFactory loggerFactory)
{
_repository = employeeRepository;
_logger = loggerFactory.GetCurrentClassLogger();
}
示例9: EventController
public EventController(IEventRepository eventRepository, ILoggerFactory loggerFactory)
{
_repository = eventRepository;
_logger = loggerFactory.GetCurrentClassLogger();
}
示例10: NewsController
public NewsController(INewsRepository newsRepository, ILoggerFactory loggerFactory)
{
_repository = newsRepository;
_logger = loggerFactory.GetCurrentClassLogger();
}
示例11: ExportZipForm
public ExportZipForm(string sourceRootPath,
string destinationFilename,
IReportServerReader reader,
FolderItemExporter folderExporter,
ReportItemExporter reportExporter,
DataSourceItemExporter dataSourceExporter,
IBundler zipBundler,
ILoggerFactory loggerFactory,
IFileSystem fileSystem)
{
if (string.IsNullOrEmpty(sourceRootPath))
throw new ArgumentException("sourceRootPath");
if (string.IsNullOrEmpty(destinationFilename))
throw new ArgumentException("destinationFilename");
if (reader == null)
throw new ArgumentNullException("reader");
if (folderExporter == null)
throw new ArgumentNullException("folderExporter");
if (reportExporter == null)
throw new ArgumentNullException("reportExporter");
if (dataSourceExporter == null)
throw new ArgumentNullException("dataSourceExporter");
if (zipBundler == null)
throw new ArgumentNullException("zipBundler");
if (loggerFactory == null)
throw new ArgumentNullException("loggerFactory");
if (fileSystem == null)
throw new ArgumentNullException("fileSystem");
InitializeComponent();
this.mSourceRootPath = sourceRootPath;
this.mExportDestinationFilename = destinationFilename;
this.mReportServerReader = reader;
this.mFolderExporter = folderExporter;
this.mReportExporter = reportExporter;
this.mDataSourceExporter = dataSourceExporter;
this.mZipBundler = zipBundler;
this.mLoggerFactory = loggerFactory;
this.mFileSystem = fileSystem;
this.mLogger = mLoggerFactory.GetCurrentClassLogger();
this.mExportOutputTempDirectory = this.GetTemporaryExportOutputFolder("SSRSMigrate_ExportZip");
this.CreateExportOutputFolder(this.mExportOutputTempDirectory);
this.mSummaryForm = new SummaryForm();
}
示例12: LogHandleErrorAttribute
public LogHandleErrorAttribute(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.GetCurrentClassLogger();
}
示例13: ProfileController
public ProfileController(ITeacherRepository teacherRepo, ILoggerFactory loggerFactory)
{
teacherRepository = teacherRepo;
_logger = loggerFactory.GetCurrentClassLogger();
}
示例14: AccountController
public AccountController(ITeacherRepository teacherRepository, ILoggerFactory loggerFactory)
{
_logger = loggerFactory.GetCurrentClassLogger();
_teacherRepository = teacherRepository;
}
示例15: BlogController
public BlogController(IBlogRepository blogRepo, ITeacherRepository teacherRepo, ILoggerFactory loggerFactory)
{
_blogRepo = blogRepo;
_teacherRepo = teacherRepo;
_logger = loggerFactory.GetCurrentClassLogger();
}