本文整理汇总了C#中Logger.Warning方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.Warning方法的具体用法?C# Logger.Warning怎么用?C# Logger.Warning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger.Warning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckMethodName
public void CheckMethodName()
{
var target = new TestTarget();
var logger = new Logger(GetType(), new[] {target});
logger.Warning("Nono!");
var entry = target.LogEntries.FirstOrDefault();
Assert.NotNull(entry);
Assert.Equal(MethodBase.GetCurrentMethod().Name, entry.MethodName);
}
示例2: Main
public static void Main()
{
var simpleLayout = new SimpleLayout();
var jsonLayout = new JsonLayout();
// var myLayout = new SoftUniLayout();
var consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.ReportLevel = ReportLevel.Error;
consoleAppender.ReportLevel = ReportLevel.Error;
var fileAppender = new FileAppendder(jsonLayout, "../../Log.txt");
fileAppender.ReportLevel = ReportLevel.Error;
var logger = new Logger(consoleAppender, fileAppender);
logger.Error("Error parsing JSON.");
logger.Warning("User John successfully registered");
logger.Info("Everything seems fine");
logger.Warning("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
fileAppender.Close();
}
示例3: Main
static void Main(string[] args)
{
Log = Logger.GetInstance();
Log.Info("Starting up");
TcpServer server = null;
if(UsingTls(args))
{
Log.Info("Using TLS");
X509Certificate2 cert = null;
var foundCert = TryGetX509Certificate(args, out cert);
// We have a certificate, so create the server
if (foundCert)
{
server = new TlsServer(IPAddress.Any, DEFAULT_PORT, cert);
}
}
else
{
Log.Warning("Not using TLS");
//insecure version
server = new TcpServer(IPAddress.Any, DEFAULT_PORT);
}
// If we can't start the server, we can't run anything
if(server == null)
{
Log.Error("Could not start the server");
Environment.Exit(1);
}
// All systems go, start the server
var registry = new Registry();
var MessageArchive = new MessageArchive();
var dispatcher = new Dispatcher(server, registry, MessageArchive);
dispatcher.Run();
}