本文整理汇总了C#中ConsoleLogger.Run方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleLogger.Run方法的具体用法?C# ConsoleLogger.Run怎么用?C# ConsoleLogger.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleLogger
的用法示例。
在下文中一共展示了ConsoleLogger.Run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
// Basic structure for one problem distribution
static void Main(string[] args)
{
#if USE_DEBUG_INNER
DebugInner();
Console.ReadKey();
return;
#endif
ConsoleLogger console = new ConsoleLogger();
GlobalLogger.AttachLogger(console);
console.Run();
DistributionServer server = new DistributionServer();
}
示例2: Main
static void Main(string[] args)
{
#region Initialize Logger
Logger console = new ConsoleLogger();
Logger logfile = new PlainTextLogger("debug.log", false);
GlobalLogger.AttachLogger(console);
GlobalLogger.AttachLogger(logfile);
console.Run();
logfile.Run();
#endregion
#region Initialize Server
try
{
using (ServiceHost svcHost = new ServiceHost(typeof(RoutingAiSlave), new Uri("http://localhost:8000/RoutingAi")))
{
svcHost.AddServiceEndpoint(typeof(RoutingAI.ServiceContracts.IRoutingAiSlaveService),
new BasicHttpBinding(), "Slave");
svcHost.Open();
Console.WriteLine("Press <ENTER> to terminate...");
Console.ReadLine();
}
}
catch (HttpListenerException x)
{
GlobalLogger.SendLogMessage("Critical", MessageFlags.Fatal, "Failed to start server host: {0}", x.Message);
GlobalLogger.SendLogMessage("Critical", MessageFlags.Fatal, "Please make sure RoutingAI.Slave is running as admin.");
}
catch (Exception x)
{
GlobalLogger.SendLogMessage("Critical", MessageFlags.Fatal, "Unexpected error: {0}", x.Message);
GlobalLogger.SendLogMessage("Critical", MessageFlags.Fatal, "Stack Dump: {0}", x.StackTrace);
}
#endregion
console.Stop();
logfile.Stop();
}