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


C# ILog.InfoFormat方法代码示例

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


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

示例1: Main

		public static void Main (String[] args, ILog logger)
		{
			int n = 0;
			if (args.Length > 0)
				n = Int32.Parse (args [0]);

			int maxDepth = Math.Max (minDepth + 2, n);
			int stretchDepth = maxDepth + 1;

			int check = (TreeNode.bottomUpTree (0, stretchDepth)).itemCheck ();
			logger.InfoFormat ("stretch tree of depth {0}\t check: {1}", stretchDepth, check);

			TreeNode longLivedTree = TreeNode.bottomUpTree (0, maxDepth);

			for (int depth = minDepth; depth <= maxDepth; depth += 2) {
				int iterations = 1 << (maxDepth - depth + minDepth);

				check = 0;
				for (int i = 1; i <= iterations; i++) {
					check += (TreeNode.bottomUpTree (i, depth)).itemCheck ();
					check += (TreeNode.bottomUpTree (-i, depth)).itemCheck ();
				}

				logger.InfoFormat ("{0}\t trees of depth {1}\t check: {2}",
					iterations * 2, depth, check);
			}

			logger.InfoFormat ("long lived tree of depth {0}\t check: {1}",
				maxDepth, longLivedTree.itemCheck ());
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:30,代码来源:binarytree.cs

示例2: Main

		/**
	 * The main routnie which creates the data structures for the Columbian
	 * health-care system and executes the simulation for a specified time.
	 *
	 * @param args the command line arguments
	 */
		public static void Main (String[] args, ILog ilog)
		{
			logger = ilog;
			parseCmdLine (args);

			Village.initVillageStatic ();

			Village top = Village.createVillage (maxLevel, 0, true, 1);

			if (printMsgs)
				logger.InfoFormat ("Columbian Health Care Simulator\nWorking...");

			for (int i = 0; i < maxTime; i++)
				top.simulate ();

			Results r = top.getResults ();

			if (printResult) {
				logger.InfoFormat ("# People treated: " + (int)r.totalPatients);
				logger.InfoFormat ("Avg. length of stay: " + r.totalTime / r.totalPatients);
				logger.InfoFormat ("Avg. # of hospitals visited: " + r.totalHospitals / r.totalPatients);
			}

			logger.InfoFormat ("Done!");
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:31,代码来源:Health.cs

示例3: Main

        public static void Main( string[] args )
        {
            try{
                _log = LogManager.GetCurrentClassLogger();
            }catch(Exception ex ){
                Console.WriteLine(ex.Message);
            }

            _log.InfoFormat("{0} ready to serve.", APP_NAME);
            // BATCH
            if (args.Length > 0) {
                CodeRunner codeRunner = new CodeRunner();
                try {
                    string padFile = args[0];
                    _log.InfoFormat("File argument: {0}", padFile);

                    // load configuration
                    PadConfig padConfig = new PadConfig();
                    if (!padConfig.Load(padFile)) {
                        _log.ErrorFormat("Error loading pad file!");
                        return;
                    }

                    // setup single factory (fast calls optimization)
                    if (padConfig.DataContext.Enabled) {
                        CustomConfiguration cfg = ServiceHelper.GetService<CustomConfiguration>();
                        cfg.FactoryRebuildOnTheFly = bool.FalseString;
                        cfg.IsConfigured = true;
                    }

                    // run
                    codeRunner.Build(padConfig);
                    codeRunner.Run();

                } catch (Exception ex) {

                    _log.ErrorFormat(ex.Message);

                } finally {

                    codeRunner.Release();
                }

            } else {

                // GUI
                try {
                    Application.Init();
                    SpoolPadWindow win = new SpoolPadWindow();
                    win.Show();
                    Application.Run();
                } catch (Exception ex) {
                    MessageHelper.ShowError(ex);
                }

            }

            _log.Info("SpoolPad goes to sleep.");
        }
开发者ID:Jodan-pz,项目名称:spoolpad,代码行数:59,代码来源:SpoolPadProgram.cs

示例4: WriteToLog

 public void WriteToLog(ILog logger)
 {
     logger.InfoFormat("Using the following options for Hangfire Server:");
     logger.InfoFormat("    Worker count: {0}.", WorkerCount);
     logger.InfoFormat("    Listening queues: {0}.", String.Join(", ", Queues.Select(x => "'" + x + "'")));
     logger.InfoFormat("    Shutdown timeout: {0}.", ShutdownTimeout);
     logger.InfoFormat("    Schedule polling interval: {0}.", SchedulePollingInterval);
 }
开发者ID:atonse,项目名称:Hangfire,代码行数:8,代码来源:BackgroundJobServerOptions.cs

示例5: usage

		/**
	 * The usage routine which describes the program options.
	 **/
		private static void usage (ILog logger)
		{
			logger.InfoFormat ("usage: java BiSort -s <size> [-p] [-i] [-h]");
			logger.InfoFormat ("    -s the number of values to sort");
			logger.InfoFormat ("    -m (print informative messages)");
			logger.InfoFormat ("    -h (print this message)");
			throw new Exception ("exit after usage info");
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:11,代码来源:BiSort.cs

示例6: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            _log = LogManager.GetLogger(GetType());
            _log.InfoFormat("Installing Consumers");

            container.Register(Component.For<ResponseFromPackageConsumer>().ImplementedBy<ResponseFromPackageConsumer>());
            container.Register(Component.For<AlwaysOnConfigurationConsumer>().ImplementedBy<AlwaysOnConfigurationConsumer>());

            _log.InfoFormat("Consumers Installed");
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:10,代码来源:ConsumerInstaller.cs

示例7: Main

		public static void Main (String[] args, ILog logger)
		{
			int n = 10000;
			if (args.Length > 0)
				n = Int32.Parse (args [0]);

			NBodySystem bodies = new NBodySystem ();

			logger.InfoFormat ("{0:f9}", bodies.Energy ());
			for (int i = 0; i < n; i++)
				bodies.Advance (0.01);
			logger.InfoFormat ("{0:f9}", bodies.Energy ());
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:13,代码来源:n-body.cs

示例8: CancelHotmailJobsByDeliveryGroup

        public static void CancelHotmailJobsByDeliveryGroup(IJobRepository jobRepository, ILog logger, DeliveryGroup deliveryGroup, DateTime cutOffTime, Event dblogEvent)
        {
            var jobs = jobRepository.GetAll().Where(j => j.deliverygroup_id == deliveryGroup.deliverygroup_id
                                                            && j.datelaunch < cutOffTime
                                                            && j.DeliveryGroup.CancelOnBulkingEnabled
                                                            && !CancellationExcludedJobStatusIds.Contains(j.jobstatus_id)).ToArray();

            foreach (var job in jobs)
            {
                job.Cancel(jobRepository,dblogEvent);
                logger.InfoFormat("Cancelled Job {0} and its targets", job.job_id);
            }
            logger.InfoFormat("Cancelled {0} Jobs", jobs.Count());
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:14,代码来源:DeliveryGroup.cs

示例9: 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

示例10: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     _log = LogManager.GetLogger(GetType());
     _log.InfoFormat("Installing Consumers");
     container.Register(
         Component.For<CacheConsumer>().ImplementedBy<CacheConsumer>());
 }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:7,代码来源:ConsumerInstaller.cs

示例11: Run

        private void Run(string[] args)
        {
            // Creating this from static causes an exception in Raspian. Not in ubunti though?
            Log  = LogManager.GetCurrentClassLogger();
            var options = new ConsoleOptions(args);

            if (options.ShowHelp)
            {
                Console.WriteLine("Options:");
                options.OptionSet.WriteOptionDescriptions(Console.Out);
                return;
            }

            var deviceFactory = new Pca9685DeviceFactory();
            var device = deviceFactory.GetDevice(options.UseFakeDevice);
            var motorController = new PwmController(device);
            motorController.Init();

            Log.InfoFormat("RPi.Console running with {0}", options);

            switch (options.Mode)
            {
                case Mode.DcMotor:
                    RunDcMotor(motorController);
                    break;

                case Mode.Servo:
                    RunServo(motorController);
                    break;

                case Mode.Stepper:
                    motorController.Stepper.Rotate(600);
                    break;

                case Mode.Led:
                    RunLed(motorController);
                    break;

                case Mode.RawPwm:
                    RunRawPwm(device);
                    break;

                case Mode.AlarmClock:
                    var alarmClock = new AlarmClock(motorController);
                    alarmClock.Set(options.AlarmDate);
                    alarmClock.WaitForAlarm();
                    break;

                case Mode.SignalRTest:
                    var signalRConnection = new SignalRConnection(motorController);
                    signalRConnection.Run();
                    break;
            }

            motorController.AllStop();
            deviceFactory.Dispose();

            //http://nlog-project.org/2011/10/30/using-nlog-with-mono.html
           // NLog.LogManager.Configuration = null;
        }
开发者ID:Revex,项目名称:RPi.Demo,代码行数:60,代码来源:Program.cs

示例12: Main

		public static void Main (string[] args, ILog logger)
		{
			int n = 1;
			int count = 0;
			Random rnd = new Random (42);
			Stopwatch st = new Stopwatch ();
			if (args.Length > 0)
				n = Int32.Parse (args [0]);

			int[] v = new int [n];
			for (int i = 0; i < n; i++)
				v [i] = i;

			/* Shuffle */
			for (int i = n - 1; i > 0; i--) {
				int t, pos;
				pos = rnd.Next () % i;
				t = v [i];
				v [i] = v [pos];
				v [pos] = t;
			}

			Dictionary<int, int> table = new Dictionary<int, int> ();

			st.Start ();
			for (int i = 0; i < n; i++)
				table.Add (v [i], v [i]);
			for (int i = 0; i < n; i++)
				table.Remove (v [i]);
			for (int i = n - 1; i >= 0; i--)
				table.Add (v [i], v [i]);
			st.Stop ();  
			logger.InfoFormat ("Addition {0}", st.ElapsedMilliseconds);

			st.Reset ();
			st.Start ();
			for (int j = 0; j < 8; j++) {
				for (int i = 0; i < n; i++) {
					if (table.ContainsKey (v [i]))
						count++;
				}	
			}
			st.Stop ();
			logger.InfoFormat ("Lookup {0} - Count {1}", st.ElapsedMilliseconds, count);
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:45,代码来源:hash3.cs

示例13: Main

		public static void Main (string[] args, ILog ilog)
		{
			int n = int.Parse (args [0]);
			for (count = 0; count < n; count++) {
				SomeFunction ();
			}
			logger = ilog;
			logger.InfoFormat ("Exceptions: HI={0} / LO={1}", Hi, Lo);
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:9,代码来源:except.cs

示例14: Start

        public void Start()
        {
            m_log = LogManager.GetLogger(this.GetType());

            m_log.InfoFormat("Starting SharpDB...");
            m_log.InfoFormat("Database Name: {0}", m_name);

            m_db = new KeyValueDatabase(filename => new DatabaseFileReader(filename), filename => new DatabaseFileWriter(filename),
                                                                     filename => new MemoryCacheProvider(filename));
            m_db.FileName = m_name + ".sdb";
            m_db.Start();

            m_context = NetMQContext.Create();

            m_server = new Network.Server(m_context, m_db, string.Format("tcp://*:{0}", m_port));

            m_task = Task.Factory.StartNew(m_server.Start);
        }
开发者ID:JackWangCUMT,项目名称:SharpDB,代码行数:18,代码来源:ServerService.cs

示例15: Main

		/**
	 * The main routine which creates a tree and sorts it a couple of times.
	 *
	 * @param args the command line arguments
	 */
		public static void Main (String[] args, ILog logger)
		{
			Value.initValue ();

			parseCmdLine (args, logger);

			if (printMsgs)
				logger.InfoFormat ("Bisort with " + treesize + " values");

			Value tree = Value.createTree (treesize, 12345768);
			int sval = Value.random (245867) % Value.RANGE;

			logger.InfoFormat ("BEGINNING BITONIC SORT ALGORITHM HERE");

			sval = tree.bisort (sval, Value.FORWARD);
			sval = tree.bisort (sval, Value.BACKWARD);

			logger.InfoFormat ("Done!");
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:24,代码来源:BiSort.cs


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