本文整理汇总了C#中ILogger.CreateChildLogger方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.CreateChildLogger方法的具体用法?C# ILogger.CreateChildLogger怎么用?C# ILogger.CreateChildLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.CreateChildLogger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileTransaction
public FileTransaction(string name, DependentTransaction inner, uint stackDepth, ITransactionOptions creationOptions,
Action onDispose, ILogger logger)
{
Contract.Requires(inner != null);
Contract.Requires(creationOptions != null);
Contract.Requires(!string.IsNullOrEmpty(name));
Contract.Requires(logger != null);
Contract.Ensures(_Name != null);
_Inner = new Transaction(inner, stackDepth, creationOptions, onDispose, logger.CreateChildLogger("Transaction"));
_Name = name;
InnerBegin();
}
示例2: LegacyDatabase
/// <summary>
/// Initialises a new instance of the <see cref="LegacyDatabase"/> class.
/// </summary>
/// <param name="logger">
/// The logger.
/// </param>
/// <param name="configurationHelper">
/// The configuration Helper.
/// </param>
public LegacyDatabase(ILogger logger, IConfigurationHelper configurationHelper)
{
this.configurationHelper = configurationHelper;
this.Log = logger.CreateChildLogger("Helpmebot.Legacy.Database.LegacyDatabase");
}
示例3: IrcClient
/// <summary>
/// Initialises a new instance of the <see cref="IrcClient"/> class.
/// </summary>
/// <param name="client">
/// The client.
/// </param>
/// <param name="logger">
/// The logger.
/// </param>
/// <param name="ircConfiguration">
/// The configuration Helper.
/// </param>
/// <param name="password">
/// The password.
/// </param>
public IrcClient(INetworkClient client, ILogger logger, IIrcConfiguration ircConfiguration, string password)
{
this.nickname = ircConfiguration.Nickname;
this.networkClient = client;
this.logger = logger;
this.syncLogger = logger.CreateChildLogger("Sync");
this.username = ircConfiguration.Username;
this.realName = ircConfiguration.RealName;
this.password = password;
this.networkClient.DataReceived += this.NetworkClientOnDataReceived;
this.ReceivedMessage += this.OnMessageReceivedEvent;
this.clientCapabilities = new List<string> { "sasl", "account-notify", "extended-join", "multi-prefix" };
this.authToServices = ircConfiguration.AuthToServices;
if (!this.authToServices)
{
this.logger.Warn("Services authentication is disabled!");
this.clientCapabilities.Remove("sasl");
this.clientCapabilities.Remove("account-notify");
this.clientCapabilities.Remove("extended-join");
}
this.userCache = new Dictionary<string, IrcUser>();
this.channels = new Dictionary<string, IrcChannel>();
this.connectionRegistrationSemaphore = new Semaphore(0, 1);
this.syncLogger.Debug("ctor() acquired connectionRegistration semaphore.");
this.RegisterConnection(null);
}
示例4: WatcherController
/// <summary>
/// Initialises a new instance of the <see cref="WatcherController"/> class.
/// </summary>
/// <param name="messageService">
/// The message Service.
/// </param>
/// <param name="urlShorteningService">
/// The url Shortening Service.
/// </param>
/// <param name="watchedCategoryRepository">
/// The watched Category Repository.
/// </param>
/// <param name="mediaWikiSiteRepository">
/// The media Wiki Site Repository.
/// </param>
/// <param name="ignoredPagesRepository">
/// The ignored Pages Repository.
/// </param>
/// <param name="logger">
/// The logger.
/// </param>
/// <param name="ircClient">
/// The IRC Client.
/// </param>
/// <param name="legacyDatabase">
/// The legacy Database.
/// </param>
protected WatcherController(
IMessageService messageService,
IUrlShorteningService urlShorteningService,
IWatchedCategoryRepository watchedCategoryRepository,
IMediaWikiSiteRepository mediaWikiSiteRepository,
IIgnoredPagesRepository ignoredPagesRepository,
ILogger logger,
IIrcClient ircClient,
ILegacyDatabase legacyDatabase)
{
this.messageService = messageService;
this.urlShorteningService = urlShorteningService;
this.watchers = new Dictionary<string, CategoryWatcher>();
this.logger = logger;
this.ircClient = ircClient;
foreach (WatchedCategory item in watchedCategoryRepository.Get())
{
var categoryWatcher = new CategoryWatcher(
item,
mediaWikiSiteRepository,
ignoredPagesRepository,
logger.CreateChildLogger("CategoryWatcher[" + item.Keyword + "]"));
this.watchers.Add(item.Keyword, categoryWatcher);
categoryWatcher.CategoryHasItemsEvent += this.CategoryHasItemsEvent;
}
this.legacyDatabase = legacyDatabase;
}
示例5: NetworkClient
/// <summary>
/// Initialises a new instance of the <see cref="NetworkClient"/> class.
/// </summary>
/// <param name="hostname">
/// The hostname.
/// </param>
/// <param name="port">
/// The port.
/// </param>
/// <param name="logger">
/// The logger.
/// </param>
/// <param name="startThreads">
/// The start threads.
/// </param>
protected NetworkClient(string hostname, int port, ILogger logger, bool startThreads)
{
this.hostname = hostname;
this.port = port;
this.logger = logger;
this.inboundLogger = logger.CreateChildLogger("Inbound");
this.outboundLogger = logger.CreateChildLogger("Outbound");
this.logger.InfoFormat("Connecting to socket tcp://{0}:{1}/ ...", hostname, port);
this.client = new TcpClient(this.hostname, this.port);
this.Reader = new StreamReader(this.client.GetStream());
this.Writer = new StreamWriter(this.client.GetStream());
this.sendQueue = new Queue<string>();
this.writerThreadResetEvent = new AutoResetEvent(true);
if (startThreads)
{
this.StartThreads();
}
}