本文整理汇总了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 ());
}
示例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!");
}
示例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.");
}
示例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);
}
示例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");
}
示例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");
}
示例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 ());
}
示例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());
}
示例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");
}
示例10: Install
public void Install(IWindsorContainer container, IConfigurationStore store)
{
_log = LogManager.GetLogger(GetType());
_log.InfoFormat("Installing Consumers");
container.Register(
Component.For<CacheConsumer>().ImplementedBy<CacheConsumer>());
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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!");
}