當前位置: 首頁>>代碼示例>>C#>>正文


C# Logger.LogWarning方法代碼示例

本文整理匯總了C#中System.Logger.LogWarning方法的典型用法代碼示例。如果您正苦於以下問題:C# Logger.LogWarning方法的具體用法?C# Logger.LogWarning怎麽用?C# Logger.LogWarning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Logger的用法示例。


在下文中一共展示了Logger.LogWarning方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LogWarningTest

 public void LogWarningTest()
 {
     Scrabble.Logger tempLog = new Logger();
     tempLog.LogWarning("Warning...","Unit Test");
     string inFile = System.IO.File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "\\Logs\\" + tempLog.now + "_VERBOSE_LOG.txt");
     Console.Write(inFile);
     Assert.IsFalse(inFile.Equals("Testing...*** WARNING - Unit Test: Warning... ***"));
 }
開發者ID:murple13,項目名稱:Scrabble_CS3450,代碼行數:8,代碼來源:LoggerTests.cs

示例2: LogWarning_SHOULD_log_with_severity_Warning

        public void LogWarning_SHOULD_log_with_severity_Warning()
        {
            const string dummyMsg = "dummy msg";
            var fakeWriter = new Mock<ILogWriter>();

            var sut = new Logger(fakeWriter.Object);
            sut.LogWarning(dummyMsg);

            fakeWriter.Verify(m => m.Write(Match.Create<LogEntry>(e => e.Severity == Severity.Warning)));
        }
開發者ID:robert-skarzycki,項目名稱:skarzycki.robert.opensource,代碼行數:10,代碼來源:LoggerTests.cs

示例3: LogWarningToJsonInputAsync

        public void LogWarningToJsonInputAsync()
        {
            var textInput = "e6d64ac2-c8e9-45e0-ac73-3298ff8cb96f";
            LogglyConfiguration.Configure(c => c.AuthenticateWith("csharptests", "Passw0rd!"));

            var logger = new Logger(textInput);
            var randomString = GenerateRandomString(8);
            logger.LogWarning(randomString);

            var signal = new AutoResetEvent(false);
            SearchJsonResponse response = null;

            new Thread(() =>
            {
                var running = true;
                while (running)
                {
                    Thread.Sleep(3000);
                    response = new Searcher("csharptests").SearchJson("message", randomString);

                    if (response.TotalRecords > 0)
                        running = false;
                }

                signal.Set();
            }).Start();

            signal.WaitOne(50 * 1000); // wait till loggly index the new event (if it didn't after 50 seconds it is broken)

            Assert.IsNotNull(response);
            Assert.AreEqual(1, response.TotalRecords);
            Assert.AreEqual(randomString, response.Results[0].Json["message"]);
            Assert.AreEqual("warning", response.Results[0].Json["category"]);
        }
開發者ID:auth10,項目名稱:loggly-csharp,代碼行數:34,代碼來源:IntegrationTests.cs

示例4: MethodCallingLogWarning

 public static void MethodCallingLogWarning(Logger logger, string msg = null)
 {
     logger.LogWarning(msg);
 }
開發者ID:robert-skarzycki,項目名稱:skarzycki.robert.opensource,代碼行數:4,代碼來源:LoggerTests.cs


注:本文中的System.Logger.LogWarning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。