本文整理汇总了C#中ILogger.WriteIndented方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.WriteIndented方法的具体用法?C# ILogger.WriteIndented怎么用?C# ILogger.WriteIndented使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.WriteIndented方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invoke
public void Invoke(ServerMessage message, IIrcClient ircClient, ILogger logger)
{
var channelName = message.GetChannelName();
var nickName = message.GetSender();
ircClient.Channels.AddIfNotExist(channelName);
if (MessageHelper.IsMessageFromMe(message, ircClient.Credentials))
{
logger.Write($"We joined channel {channelName}");
ircClient.TwitchService.AddToStreamWatchList(channelName);
var viewers = TwitchApiClient.GetChatters(channelName.Substring(1));
logger.Write($"Got {viewers.Count} viewers from API. Loading them now:");
foreach (var viewer in viewers)
{
logger.WriteIndented($"API: {viewer} on channel {channelName}");
var user = ircClient.UserService.GetOrCreateUser(viewer, channelName);
ircClient.Channels[channelName].AddUser(user);
}
var moderators = TwitchApiClient.GetOnlieModerators(channelName.Substring(1));
logger.Write($"Got {moderators.Count} moderators from API. Loading them now:");
foreach (var moderator in moderators)
{
logger.WriteIndented($"API: {moderator} (mod) on channel {channelName}");
var user = ircClient.UserService.GetOrCreateUser(moderator, channelName);
user.IsModerator = true;
ircClient.Channels[channelName].AddUser(user);
}
logger.Write("Done loading users found through API.");
}
else
{
//Load any data we have on this client from the database, then add it to our internal list of users
logger.Write($"JOIN {nickName} on channel {channelName}");
var user = ircClient.UserService.GetOrCreateUser(nickName, channelName);
ircClient.Channels[channelName].AddUser(user);
}
}
示例2: MessageProcessor
public MessageProcessor(PluginManager pluginManager, ILogger logger)
{
_logger = logger;
pluginManager.Compose(this, logger);
_logger.Write($"Found {HandlerInstances.Count} message handlers:");
foreach (var messageHandler in HandlerInstances)
{
_logger.WriteIndented($"{messageHandler.GetType().Name} ({string.Join(", ", messageHandler.Commands)})");
}
}
示例3: Compose
public void Compose(object target, ILogger logger)
{
var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
var owningAssemblyCatalog = new AssemblyCatalog(_callingAssembly);
//load any plugins from the plugins folder
var pluginsCatalog = new DirectoryCatalog("Plugins", "*.dll");
var catalog = new AggregateCatalog(assemblyCatalog, pluginsCatalog, owningAssemblyCatalog);
var container = new CompositionContainer(catalog);
container.SatisfyImportsOnce(target);
logger.Write("Handlers loaded:");
logger.WriteIndented($"{Path.GetFileName(Assembly.GetExecutingAssembly().Location)} ({FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion})");
logger.WriteIndented($"{Path.GetFileName(_callingAssembly.Location)} ({FileVersionInfo.GetVersionInfo(_callingAssembly.Location).FileVersion})");
logger.Write("Plugins loaded:");
foreach (var file in pluginsCatalog.LoadedFiles)
{
logger.WriteIndented($"{Path.GetFileName(file).ToLower()} ({FileVersionInfo.GetVersionInfo(file).FileVersion})");
}
}