Пример #1
0
 /// <summary>
 /// Writes the log message at the <see cref="LogLevel.Debug"/> level optionally using the specified <paramref name="args"/> as a message format parameters.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="args">The arguments.</param>
 /// <returns>The instance of the owner object.</returns>
 public TOwner Debug(string message, params object[] args)
 {
     logManager.Debug(message, args);
     return(owner);
 }
Пример #2
0
 public void Debug(object message)
 {
     _logManager.Debug(message);
 }
Пример #3
0
        public ActionResult NLog(TaskViewModel viewModel)
        {
            viewModel.OperationResult.Clear();

            try
            {
                if (IsTask("NLog", viewModel.OperationResult))
                {
                    if (IsValid(viewModel.OperationResult, viewModel))
                    {
                        ILogManager logManager = DependencyResolver.Current.GetService <ILogManager>();

                        logManager.Trace("Trace");
                        logManager.Debug("Debug");
                        logManager.Information("Information");
                        logManager.Warning("Warning");
                        logManager.Error("Error");
                        logManager.Fatal("Fatal");

                        logManager.Trace("Trace", new object[] { "ABC", 1.23, DateTime.Now });
                        logManager.Debug("Debug", new object[] { "ABC", 1.23, DateTime.Now });
                        logManager.Information("Information", new object[] { "ABC", 1.23, DateTime.Now });
                        logManager.Warning("Warning", new object[] { "ABC", 1.23, DateTime.Now });
                        logManager.Error("Error", new object[] { "ABC", 1.23, DateTime.Now });
                        logManager.Fatal("Fatal", new object[] { "ABC", 1.23, DateTime.Now });

                        logManager.Trace("{Parameter1} {Parameter2} {Parameter3}", "ABC", 1.23, DateTime.Now);

                        try
                        {
                            int x = Int32.Parse("ABC");
                            int y = x + 1;
                        }
                        catch (Exception exception)
                        {
                            logManager.Exception(exception, "ABC");
                        }

                        try
                        {
                            int x = Int32.Parse("ABC");
                            int y = x + 1;
                        }
                        catch (Exception exception)
                        {
                            ZOperationResult operationResult = new ZOperationResult();
                            operationResult.ParseException(exception);
                            AppHelper.Log(operationResult, Request.Url.OriginalString);
                        }

                        {
                            int x = Int32.Parse("ABC");
                            int y = x + 1;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }

            return(ZView("Task", viewModel));
        }
Пример #4
0
 public void Post([FromBody] string value)
 {
     _log.Debug("这是一个测试信息Debug");
 }