当前位置: 首页>>代码示例>>C#>>正文


C# ILog.Trace方法代码示例

本文整理汇总了C#中ILog.Trace方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.Trace方法的具体用法?C# ILog.Trace怎么用?C# ILog.Trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILog的用法示例。


在下文中一共展示了ILog.Trace方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OutputSQL

 /// <summary>
 ///     Compiles the Context to execution of a query and tracks the time spent
 /// </summary>
 /// <param name="context">the context to run the test against</param>
 /// <param name="log">The log to output the information to</param>
 /// <param name="queries">the list of queries to be output</param>
 /// <exception cref="InvalidOperationException">
 ///     If the compilation does not meet the expected time, it will throw this
 ///     error
 /// </exception>
 public static void OutputSQL(this IDataContext context, ILog log, params IQueryBase[] queries)
 {
     log.TraceFormat("Beginning Sql Output");
     foreach (IQueryBase query in queries)
     {
         log.Trace("************************************************");
         log.TraceFormat("SQL Statement for {0}", query.GetType().Name);
         log.Trace("------------------------------------------------");
         query.OutputQuery(context);
         log.Trace("************************************************");
     }
     log.Trace("SQL Output Completed");
 }
开发者ID:joswalt,项目名称:Highway.Data,代码行数:23,代码来源:LoggingTraceExtensions.cs

示例2: BaseStrategy

 public BaseStrategy(ILog log, ICommandExecutor commandExecutor, ICommandFabric commandFabric)
 {
     this.log = log;
     this.commandFabric = commandFabric;
     this.commandExecutor = commandExecutor;
     this.construct = (name, db) => commandFabric.Get(name, db);
     this.fail = (f) =>
     {
         log.Exception(f.Command.ToString(), f.Error);
         throw f.Error;
     };
     this.success = (s) => log.Trace(s.Command.ToString());
     this.progress = (p) => log.Trace(p.PercentDone.ToString());
 }
开发者ID:Udgin,项目名称:datagenerator,代码行数:14,代码来源:BaseStrategy.cs

示例3: InitDslFactory

        protected override void InitDslFactory(ILog logger, DslConfigurationSection configSection)
        {
            VariablesDslEngine variablesDslEngine = new VariablesDslEngine();
            variablesDslEngine.Storage = new BooFileSystemDslEngineStorage { FileNameFormat = "*.var" };
            this.dslFactory.Register<GlobalVariables>(variablesDslEngine);
            logger.Trace(x => x("VariablesDslEngine for *.var files successully registered"));

            this.dslFactory.Register<Service>(new ServiceDslEngine());
            logger.Trace(x => x("ServiceDslEngine for *.boo files successully registered"));

            HostDslEngine hostDslEngine = new HostDslEngine();
            hostDslEngine.Storage = new BooFileSystemDslEngineStorage { FileNameFormat = "*.host" };
            this.dslFactory.Register<Host>(hostDslEngine);
            logger.Trace(x => x("HostDslEngine for *.host files successully registered"));
        }
开发者ID:johannes-brunner,项目名称:DslConfig,代码行数:15,代码来源:BooDslConfiguration.cs

示例4: Intercept

 public void Intercept(IInvocation invocation)
 {
     _logger = _logFactory.GetLogger(invocation.TargetType);
     if (_logger.IsTraceEnabled) _logger.Trace(_invocationLogStringBuilder.BuildLogString(invocation, InvocationPhase.Start));
     try
     {
         invocation.Proceed();
         if (_logger.IsTraceEnabled) _logger.Trace(_invocationLogStringBuilder.BuildLogString(invocation, InvocationPhase.End));
     }
     catch (Exception ex)
     {
         if (_logger.IsErrorEnabled) _logger.Error(_invocationLogStringBuilder.BuildLogString(invocation, InvocationPhase.Error), ex);
         throw;
     }
 }
开发者ID:trondr,项目名称:NMultiTool,代码行数:15,代码来源:TraceLogAspect.cs

示例5: EventSocket

        /// <summary>
        /// Instantiates an <see cref="EventSocket"/> instance wrapping the provided <seealso cref="TcpClient"/>
        /// </summary>
        /// <param name="tcpClient">A TcpClient.</param>
        /// <param name="responseTimeOut">(Optional) The response timeout.</param>
        protected EventSocket(TcpClient tcpClient, TimeSpan? responseTimeOut = null) : base(tcpClient)
        {
            Log = LogProvider.GetLogger(GetType());

            ResponseTimeOut = responseTimeOut ?? TimeSpan.FromSeconds(5);

            messages =
                Receiver.SelectMany(x => Encoding.UTF8.GetString(x))
                        .AggregateUntil(() => new Parser(), (builder, ch) => builder.Append(ch), builder => builder.Completed)
                        .Select(builder => builder.ExtractMessage())
                        .SubscribeOn(TaskPoolScheduler.Default)
                        .Do(x => Log.Trace("Messages Received [{0}].".Fmt(x.ContentType)), ex => { }, () => Log.Info(() => "Messages Observable completed."))
                        .Publish()
                        .RefCount();

            Log.Trace(() => "EventSocket initialized");
        }
开发者ID:derwasp,项目名称:NEventSocket,代码行数:22,代码来源:EventSocket.cs

示例6: ScopeLogger

        /// <summary>
        /// Initializes a new instance of the <see cref="ScopeLogger"/> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        public ScopeLogger(ILog logger)
        {
            if (!logger.IsTraceEnabled) return;

            _logger = logger;
            _methodName = new StackFrame(2).GetMethod().Name;
            _logger.Trace("Enter " + _methodName);
            _shouldLog = true;
        }
开发者ID:dotnetdesign,项目名称:Common,代码行数:13,代码来源:ScopeLogger.cs

示例7: ObservableSocket

        /// <summary>
        /// Initializes a new instance of the <see cref="ObservableSocket"/> class.
        /// </summary>
        /// <param name="tcpClient">The TCP client to wrap.</param>
        protected ObservableSocket(TcpClient tcpClient)
        {
            Log = LogProvider.GetLogger(GetType());

            this.tcpClient = tcpClient;

            receiver = received
                .GetConsumingEnumerable()
                .ToObservable(TaskPoolScheduler.Default)
                        .Finally(
                            () =>
                                {
                                    Log.Trace(() => "Buffer Read Observable Completed {0} chunks left.".Fmt(received.Count));
                                    received.Dispose();
                                    received = null;
                                });

            readSubscription = Observable.Defer(
                () =>
                    {
                        var stream = tcpClient.GetStream();
                        var buffer = SharedPools.ByteArray.Allocate();
                        return
                            Observable.FromAsync(() => stream.ReadAsync(buffer, 0, buffer.Length))
                                      .Select(x => buffer.Take(x).ToArray())
                                      .Finally(() => SharedPools.ByteArray.Free(buffer));
                    })
                    .Repeat()
                    .TakeWhile(x => x.Any())
                    .Subscribe(
                        (bytes) => received.Add(bytes), 
                        ex =>
                            {
                                Log.ErrorException("Read Failed", ex);
                                Dispose();
                            }, 
                        () =>
                            {
                                Log.Trace(() => "Socket Read Observable Completed");
                                Dispose();
                            });
        }
开发者ID:bushadam,项目名称:NEventSocket,代码行数:46,代码来源:ObservableSocket.cs

示例8: WriteToLog

 private void WriteToLog(LogLevel logLevel, ILog log, string text, Exception e)
 {
     switch (logLevel)
     {
         case LogLevel.All:
         case LogLevel.Trace:
             if (log.IsTraceEnabled)
             {
                 if (e == null) log.Trace(text); else log.Trace(text, e);
             }
             break;
         case LogLevel.Debug:
             if (log.IsDebugEnabled)
             {
                 if (e == null) log.Debug(text); else log.Debug(text, e);
             }
             break;
         case LogLevel.Error:
             if (log.IsErrorEnabled)
             {
                 if (e == null) log.Error(text); else log.Error(text, e);
             }
             break;
         case LogLevel.Fatal:
             if (log.IsFatalEnabled)
             {
                 if (e == null) log.Fatal(text); else log.Fatal(text, e);
             }
             break;
         case LogLevel.Info:
             if (log.IsInfoEnabled)
             {
                 if (e == null) log.Info(text); else log.Info(text, e);
             }
             break;
         case LogLevel.Warn:
             if (log.IsWarnEnabled)
             {
                 if (e == null) log.Warn(text); else log.Warn(text, e);
             }
             break;
         case LogLevel.Off:
         default:
             break;
     }
 }
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:46,代码来源:SimpleLoggingAdvice.cs

示例9: CanLogMessageWithException

 protected virtual void CanLogMessageWithException(ILog log)
 {
     log.Trace(m => m("Hi {0}", "dude"));
     log.Debug(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Info(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Warn(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Error(m => m("Hi {0}", "dude"), new ArithmeticException());
     log.Fatal(m => m("Hi {0}", "dude"), new ArithmeticException());
 }
开发者ID:briandealwis,项目名称:gt,代码行数:9,代码来源:AbstractSimpleLogTest.cs

示例10: TestDefaultAdvisorAutoProxyCreator

 public TestDefaultAdvisorAutoProxyCreator()
 {
     _logger = LogManager.GetLogger(this.GetType().Name + "#" + GetHashCode());
     _logger.Trace("Created instance");
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:5,代码来源:AdvisorAutoProxyCreatorCircularReferencesTests.cs

示例11: TestObjectFactoryObject

 public TestObjectFactoryObject()
 {
     _logger = LogManager.GetLogger(this.GetType().Name + "#" + this.GetHashCode());
     _logger.Trace("Created instance");
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:5,代码来源:AdvisorAutoProxyCreatorCircularReferencesTests.cs

示例12: InvokeWithTrace

        protected void InvokeWithTrace(ILog logger, IInvocation invocation)
        {
            ++InvocationLevel;

            try {
                if (!string.IsNullOrEmpty(EnterMessage)) {
                    logger.Trace(GetFormattedMessage(EnterMessage, invocation));
                }

                invocation.Proceed();

                if (!string.IsNullOrEmpty(ExitMessage)) {
                    logger.Trace(GetFormattedMessage(ExitMessage, invocation));
                }
            }
            catch (Exception e) {
                if (!string.IsNullOrEmpty(ExceptionMessage)) {
                    logger.Trace(GetFormattedMessage(ExceptionMessage, invocation, e), e);
                }
                throw;
            }
            finally {
                --InvocationLevel;
            }
        }
开发者ID:bdevic,项目名称:castle-windsor-interceptors,代码行数:25,代码来源:TracingInterceptor.cs


注:本文中的ILog.Trace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。