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


C# ILog.Info方法代码示例

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


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

示例1: EnsureTargetFile

 static void EnsureTargetFile(string pathToLock, ILog log)
 {
     try
     {
         var directoryName = Path.GetDirectoryName(pathToLock);
         if (!Directory.Exists(directoryName))
         {
             log.Info("Directory {0} does not exist - creating it now", pathToLock);
             Directory.CreateDirectory(directoryName);
         }
     }
     catch (IOException)
     {
         //Someone else did this under us
     }
     try
     {
         if (!File.Exists(pathToLock))
         {
             File.WriteAllText(pathToLock, "A");
         }
     }
     catch (IOException)
     {
         //Someone else did this under us
     }
 }
开发者ID:xenoputtss,项目名称:Rebus,代码行数:27,代码来源:FilesystemExclusiveLock.cs

示例2: DoLogDirectoryContent

        public static void DoLogDirectoryContent(ILog logger, string directory)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");

            bool exists = Directory.Exists(directory);

            logger.Info("-- Logging directory content:");
            logger.Info("Directory: '" + directory + "'");
            logger.Info("Directory exists: " + exists);

            if (exists)
            {
                string[] files = Directory.GetFiles(directory);
                foreach (string file in files)
                {
                    FileInfo fileInfo = new FileInfo(file);
                    logger.Info("File: '" + file + "' (size=" + fileInfo.Length + ")");
                }

                string[] directories = Directory.GetDirectories(directory);
                foreach (string subDirectory in directories)
                {
                    logger.Info("Directory: '" + subDirectory + "'");
                }
            }

            logger.Info("--");
        }
开发者ID:ViniciusConsultor,项目名称:hudson-tray-tracker,代码行数:29,代码来源:LoggingHelper.cs

示例3: Main

        static void Main(string[] args)
        {
            _log = LogManager.GetLogger("Queaso.ConsoleClient.Main");
            try
            {
                _log.Info(l => l("Start client application..."));

                _log.Info(l => l("Exercise 1 - Work with ChannelFactory & Channel"));

                Exercise1();

                _log.Info(l => l("Exercise 2 - Work with Client Proxies"));
                
                Exercise2();

                _log.Info(l => l("Behaviours"));

                var customerProxy = new CustomerProxy();
                customerProxy.IsThisAnException();

                Thread.Sleep(50);

                
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                throw ex;
            }
        
        }
开发者ID:RubyGonzalez,项目名称:Queaso.Samples,代码行数:31,代码来源:Program.cs

示例4: CallAllMethodsOnLog

        protected void CallAllMethodsOnLog(ILog log)
        {
            Assert.IsTrue(log.IsDebugEnabled);
            Assert.IsTrue(log.IsErrorEnabled);
            Assert.IsTrue(log.IsFatalEnabled);
            Assert.IsTrue(log.IsInfoEnabled);
            Assert.IsTrue(log.IsWarnEnabled);

            log.Debug("Testing DEBUG");
            log.Debug("Testing DEBUG Exception", new Exception());
            log.DebugFormat("Testing DEBUG With {0}", "Format");

            log.Info("Testing INFO");
            log.Info("Testing INFO Exception", new Exception());
            log.InfoFormat("Testing INFO With {0}", "Format");

            log.Warn("Testing WARN");
            log.Warn("Testing WARN Exception", new Exception());
            log.WarnFormat("Testing WARN With {0}", "Format");

            log.Error("Testing ERROR");
            log.Error("Testing ERROR Exception", new Exception());
            log.ErrorFormat("Testing ERROR With {0}", "Format");

            log.Fatal("Testing FATAL");
            log.Fatal("Testing FATAL Exception", new Exception());
            log.FatalFormat("Testing FATAL With {0}", "Format");
        }
开发者ID:afyles,项目名称:NServiceBus,代码行数:28,代码来源:BaseLoggerFactoryTests.cs

示例5: Main

        private static int Main(string[] args)
        {
            var options = new Options();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                LogFactory.IsVerbose = options.Verbose;
                Log = LogManager.GetCurrentClassLogger();
                try
                {
                    IReportBuilderFactory builderFactory = new ReportBuilderFactory();
                    var builder = builderFactory.Create();
                    builder.Build(options);
                }
                catch (AppException ex)
                {
                    Log.Error(ex.Message);
                    Log.Info("Error occurs. Run sign -help to get more info.", ex);
                    return ex.ErrorCode;
                }
                catch (Exception ex)
                {
                    Log.Error("Internal error. Run with -verbose to see more details");
                    Log.Info(ex.Message, ex);
                    return ErrorCodes.InternalError;
                }

                return ErrorCodes.Ok;
            }
            return ErrorCodes.ParserError;
        }
开发者ID:rjasica,项目名称:HtmlWarningsReportGenerator,代码行数:30,代码来源:Program.cs

示例6: Main

        static void Main(string[] args)
        {
            var loggingSettings = new NameValueCollection
            {
                ["configType"] = "FILE",
                ["configFile"] = "NLog.config"
            };

            LogManager.Adapter = new NLogLoggerFactoryAdapter(loggingSettings);

            Logger = LogManager.GetLogger("NetworkRail.ScheduleParser.Console");

            if (Logger.IsInfoEnabled)
                Logger.Info("Starting up...");

            const string url = "https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-thu.CIF.gz";

            var container = CifParserIocContainerBuilder.Build();

            if (Logger.IsInfoEnabled)
                Logger.Info("Dependency Injection container built.");

            var scheduleManager = container.Resolve<IScheduleManager>();

            var entites = scheduleManager.GetRecordsByScheduleFileUrl(url).ToList();

            entites = scheduleManager.MergeScheduleRecords(entites).ToList();

            scheduleManager.SaveScheduleRecords(entites);

            Console.WriteLine("Press any key to close...");
            Console.ReadLine();
        }
开发者ID:tomlane,项目名称:OpenRailData,代码行数:33,代码来源:Program.cs

示例7: BasicChannel

        protected BasicChannel(EventMessage eventMessage, EventSocket eventSocket)
        {
            Log = LogProvider.GetLogger(GetType());

            UUID = eventMessage.UUID;
            lastEvent = eventMessage;
            this.eventSocket = eventSocket;

            Disposables.Add(
                eventSocket.Events
                           .Where(x => x.UUID == UUID)
                           .Subscribe(
                               e =>
                                   {
                                       lastEvent = e;

                                       if (e.EventName == EventName.ChannelAnswer)
                                       {
                                           Log.Info(() => "Channel [{0}] Answered".Fmt(UUID));
                                       }

                                       if (e.EventName == EventName.ChannelHangup)
                                       {
                                           Log.Info(() => "Channel [{0}] Hangup Detected [{1}]".Fmt(UUID, e.HangupCause));
                                           HangupCallBack(e);
                                       }
                                   }));
        }
开发者ID:bushadam,项目名称:NEventSocket,代码行数:28,代码来源:BasicChannel.cs

示例8: OnStart

        protected override void OnStart(string[] args)
        {
            _log = _log??LogManager.GetLogger(typeof(MainJobService));
            ISchedulerFactory scheduler = new StdSchedulerFactory();
            _sche =  scheduler.GetScheduler();
            _log.Info("starting scheduler...");
            _sche.Start();
            _log.Info("started scheduler...");

        }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:10,代码来源:MainJobService.cs

示例9: Intercept

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

示例10: CreateTransaction

        /// <summary>
        /// Create a new instance to generate a transaction to Punto Pagos
        /// </summary>
        /// <returns></returns>
        public Transaction CreateTransaction()
        {
            if (_logger == null)
            {
                _logger = Log4NetLoggerProxy.GetLogger("PuntoPagos-sdk");
                _logger.Info("Logger for log4net Start");
            }

            if(string.IsNullOrEmpty(_configuration.ClientKey) || string.IsNullOrEmpty(_configuration.ClientSecret))
            {
                if(string.IsNullOrEmpty(ConfigurationManager.AppSettings["PuntoPago-Secret"]))
                    throw new ArgumentNullException("PuntoPago-Secret", "The PuntoPago-Secret in AppSettings can not be null or empty");

                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["PuntoPago-Key"]))
                    throw new ArgumentNullException("PuntoPago-Key", "The PuntoPago-Key in AppSettings can not be null or empty");

                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["PuntoPago-Environment"]))
                    throw new ArgumentNullException("PuntoPago-Environment", "The PuntoPago-Environment in AppSettings can not be null or empty ");

                _configuration.ClientSecret = ConfigurationManager.AppSettings["PuntoPago-Secret"];
                _configuration.ClientKey = ConfigurationManager.AppSettings["PuntoPago-Key"];
                _configuration.Environment = ConfigurationManager.AppSettings["PuntoPago-Environment"];

                _logger.Debug("End configurate ClientSecret, ClientKey and Environment from AppSettings");
            }
            else
            {
                _logger.Debug("End configurate ClientSecret, ClientKey and Environment from Code");
            }

            return new Transaction(_configuration, PuntoPagoFactory.CreateAuthorization(_configuration, _logger),
                                   PuntoPagoFactory.CreateExecutorWeb(_logger), _logger);
        }
开发者ID:acidlabs,项目名称:puntopagos-sdk,代码行数:37,代码来源:PuntoPago.cs

示例11: Pull

 public void Pull(string workingDirectory, ILog log, IBounce bounce)
 {
     using (new DirectoryChange(workingDirectory)) {
         log.Info("pulling git repo in: " + workingDirectory);
         Git(bounce, "pull");
     }
 }
开发者ID:nbucket,项目名称:bounce,代码行数:7,代码来源:GitCommand.cs

示例12: InitializeScheduling

 private void InitializeScheduling()
 {
     _log = LogManager.GetLogger(typeof(JobService));
     ISchedulerFactory sf = new StdSchedulerFactory();
     _sched = sf.GetScheduler();
     _log.Info("** Initialized **");
 }
开发者ID:jondot,项目名称:janitor,代码行数:7,代码来源:JobService.cs

示例13: WriteSomeLogs

        private static void WriteSomeLogs(ILog logTunnel)
        {
            using (logTunnel.CreateScope("Starting somthing"))
            {
                logTunnel.Info("Test LogEntry {IntValue} {StringValue}", new
                                                                            {
                                                                                IntValue = 5,
                                                                                StringValue = "MyValue",
                                                                                Complex =
                                                                                    new ComplexData()
                                                                                    {
                                                                                        Complex2 =
                                                                                            new ComplexData()
                                                                                    },
                                                                            });

                logTunnel.Warning("My Warning");

                logTunnel.Log("Custom", "Non spesific log title");

                logTunnel.Error("Test LogEntry {*}", new
                                                        {
                                                            IntValue = 5,
                                                            StringValue = "MyValue",
                                                            Complex = new ComplexData()
                                                                      {
                                                                          //ExtraProp = 2,
                                                                          Complex2 = new ComplexDataDerived(),
                                                                      }
                                                        });

            }
        }
开发者ID:ronenbarak,项目名称:Whitelog,代码行数:33,代码来源:Program.cs

示例14: Run

        public static void Run(ILog log)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, args) => log.Error(args.ExceptionObject.ToString());

            var configuration = new Configuration.Configuration();
            var host = new ServiceHost(new WebSiteService(), new Uri(string.Format("http://{0}:{1}", Environment.MachineName, configuration.WebSiteHost)));

            host.AddServiceEndpoint(typeof(IWebSiteService), new WebHttpBinding(), "")
                .Behaviors.Add(new WebHttpBehavior { DefaultOutgoingResponseFormat = WebMessageFormat.Json, DefaultOutgoingRequestFormat = WebMessageFormat.Json });
            host.Open();
            log.Info("Web communication host has been successfully opened");

            while (true)
            {

                try
                {
                    new AutomatedPostReview(log, configuration).Run();
                }
                catch (Exception ex)
                {
                    log.Error(ex.ToString());
                }
                Thread.Sleep(configuration.Timeout);
            }
        }
开发者ID:ayezutov,项目名称:ReviewBoardUtilities,代码行数:26,代码来源:Program.cs

示例15: Start

        public void Start(ConcoctConfiguration config, ILog log)
        {
            try {
                var site = Assembly.LoadFrom(config.ApplicationAssemblyPath);
                var types = site.GetTypes();
                var httpApplicationType = types.Where(x => x.IsTypeOf<HttpApplication>()).First();

                FileRouteHandler.MapPath = path => path.Replace("~", config.WorkingDirectory);

                host = MvcHost.Create(
                    config.GetEndPoint(),
                    config.VirtualDirectoryOrPrefix,
                    config.WorkingDirectory,
                    httpApplicationType);

                if(config.LogRequests)
                    host.RequestHandler.BeginRequest += (_, e) => log.Info("{0} {1}", e.Request.HttpMethod, e.Request.Url);

                host.Start();
            } catch(FileNotFoundException appNotFound) {
                log.Error("Failed to locate {0}", appNotFound.FileName);
                throw new ApplicationException("Failed to load application");
            } catch(ReflectionTypeLoadException loadError) {
                log.Error("Error applications.");
                foreach(var item in loadError.LoaderExceptions) {
                    Console.Error.WriteLine(item);
                }
                throw new ApplicationException("Failed to load application", loadError);
            }
        }
开发者ID:drunkcod,项目名称:Concoct,代码行数:30,代码来源:ConcoctApplication.cs


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