本文整理汇总了C#中ConsoleLogger.Log方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleLogger.Log方法的具体用法?C# ConsoleLogger.Log怎么用?C# ConsoleLogger.Log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleLogger
的用法示例。
在下文中一共展示了ConsoleLogger.Log方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main(string[] args)
{
var logger = new ConsoleLogger();
logger.Log("Shipment processor console app start");
var shipmentProcessor = new ShipmentProcessor(logger);
while (true) {
logger.Log("");
shipmentProcessor.Run();
Thread.Sleep(5000);
logger.Log("");
}
}
示例2: Log_Message
public void Log_Message() {
System.Text.StringBuilder sb = new System.Text.StringBuilder();
using (System.IO.TextWriter w = new System.IO.StringWriter(sb)) {
Console.SetOut(w);
ILogger logger = new ConsoleLogger();
logger.Log("test message", false);
Assert.IsTrue(sb.ToString().Contains("test message"));
}
}
示例3: Main
/// <summary>
/// The main entry point into the application.
/// </summary>
/// <param name="args">The set of arguments passed in on the command line.</param>
public static void Main(string[] args)
{
Options commandLineOptions = new Options(args);
logger = new ConsoleLogger(commandLineOptions.LoggingLevel);
if (commandLineOptions.ReserveUrl)
{
bool urlReserved = ReserveUrl(commandLineOptions.UrlToReserve, true);
if (!urlReserved)
{
Environment.ExitCode = 1;
}
}
else
{
LogVersionDetails(commandLineOptions);
userName = commandLineOptions.UserName;
password = commandLineOptions.Password;
ignoreRemoteShutdown = commandLineOptions.IgnoreRemoteShutdown;
httpServer = new RemoteWebDriverServer(commandLineOptions.Port, "wd/hub/", logger);
httpServer.ShutdownRequested += new EventHandler(OnRemoteServerShutdownRequested);
bool urlReservationExists = CheckForUrlReservation(commandLineOptions);
if (urlReservationExists)
{
httpServer.StartListening();
logger.Log(string.Format(CultureInfo.InvariantCulture, "Server started. RemoteWebDriver instances connect to http://<this machine name>:{0}/wd/hub/", commandLineOptions.Port), LogLevel.Info);
if (!string.IsNullOrEmpty(commandLineOptions.HubLocation))
{
httpServer.RegisterWithHub(commandLineOptions.HubLocation);
}
Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress);
while (continueRunning)
{
System.Threading.Thread.Sleep(100);
}
}
}
}