本文整理汇总了C#中Logger.Info方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.Info方法的具体用法?C# Logger.Info怎么用?C# Logger.Info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger.Info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Launch
public int Launch()
{
CommonOptions commonOptions = _modeRunner.CommonOptions;
IDirectoryLocation outFolder = commonOptions.OutputDirectory;
var log = outFolder.GetFileLocation("CanvasLog.txt");
var error = outFolder.GetFileLocation("CanvasError.txt");
using (ILogger logger = new Logger(log, error))
{
try
{
logger.Info($"Running Canvas {_mode} {_version}");
logger.Info($"Command-line arguments: {string.Join(" ", _args)}");
using (ICheckpointRunner checkpointRunner =
GetCheckpointRunner(
logger,
outFolder,
commonOptions.StartCheckpoint,
commonOptions.StopCheckpoint,
commonOptions.WholeGenomeFasta))
{
IDirectoryLocation loggingFolder = outFolder.CreateSubdirectory(IsasFilePaths.LoggingFolderName);
IsasConfiguration config = IsasConfiguration.GetConfiguration();
IWorkManager workManager = new LocalWorkManager(logger, loggingFolder, 0, config.MaximumMemoryGB, config.MaximumHoursPerProcess);
_modeRunner.Run(logger, checkpointRunner, workManager);
}
}
catch (Exception e)
{
logger.Error($"Canvas workflow error: {e}");
return -1;
}
}
return 0;
}
示例2: OnActivateAsync
public override Task OnActivateAsync()
{
logger = LogManager.GetLogger("GrainBasedMembershipTable", LoggerType.Runtime);
logger.Info(ErrorCode.MembershipGrainBasedTable1, "GrainBasedMembershipTable Activated.");
table = new InMemoryMembershipTable();
return TaskDone.Done;
}
示例3: Main
public static void Main()
{
ILayout simpleLayout = new SimpleLayout();
IAppender consoleAppender = new ConsoleAppender(simpleLayout);
var fileAppender = new FileAppender(simpleLayout);
fileAppender.File = "../../log.txt";
var logger = new Logger(consoleAppender, fileAppender);
logger.Error("Error parsing JSON.");
logger.Info(string.Format("User {0} successfully registered.", "Dobri"));
logger.Warn("Warning - missing files.");
var xmlLayout = new XmlLayout();
consoleAppender = new ConsoleAppender(xmlLayout);
logger = new Logger(consoleAppender);
logger.Fatal("mscorlib.dll does not respond");
logger.Critical("No connection string found in App.config");
consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.ReportLevel = ReportLevel.Error;
logger = new Logger(consoleAppender);
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
示例4: Main
static void Main()
{
Logger logger = new Logger(new FileAppender(new SimpleLayout(), "log.txt"));
logger.Critical("asdasd");
logger.Warn("asdasd");
logger.Info("asdasd");
}
示例5: TestLogging
private static void TestLogging()
{
var logger = new Logger<CommonRegistry>();
logger.Debug("Testing Debug Log.");
logger.Info("Testing Info Log.");
logger.Warn("Testing Warn Log.");
logger.Error("Testing Error Log.");
}
示例6: TestInterfaces
private static void TestInterfaces()
{
ILayuot simpleLayout = new SimpleLayuot();
IAppender consoleAppender =
new ConsoleAppender(simpleLayout);
ILogger logger = new Logger(consoleAppender);
logger.Error("Error parsing JSON.");
logger.Info($"User {"Pesho"} successfully registered.");
}
示例7: Main
static void Main(string[] args)
{
Log = Logger.GetInstance();
Log.Info("Starting up");
TcpServer server = null;
if(UsingTls(args))
{
Log.Info("Using TLS");
X509Certificate2 cert = null;
var foundCert = TryGetX509Certificate(args, out cert);
// We have a certificate, so create the server
if (foundCert)
{
server = new TlsServer(IPAddress.Any, DEFAULT_PORT, cert);
}
}
else
{
Log.Warning("Not using TLS");
//insecure version
server = new TcpServer(IPAddress.Any, DEFAULT_PORT);
}
// If we can't start the server, we can't run anything
if(server == null)
{
Log.Error("Could not start the server");
Environment.Exit(1);
}
// All systems go, start the server
var registry = new Registry();
var MessageArchive = new MessageArchive();
var dispatcher = new Dispatcher(server, registry, MessageArchive);
dispatcher.Run();
}
示例8: TestFileAppender
private static void TestFileAppender()
{
var simpleLayout = new SimpleLayuot();
var consoleAppender = new ConsoleAppender(simpleLayout);
var fileAppender = new FileAppender(simpleLayout);
fileAppender.File = "log.txt";
var logger = new Logger(consoleAppender, fileAppender);
logger.Error("Error parsing JSON.");
logger.Info($"User {"Pesho"} successfully registered.");
logger.Warn("Warning - missing files.");
}
示例9: Main
static void Main(string[] args)
{
ILayout simpleLayout = new SimpleLayout();
IAppender consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.ReportLevel = ReportLevel.Error;
ILogger logger = new Logger(consoleAppender);
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
示例10: TestTreshold
private static void TestTreshold()
{
var simpleLayout = new SimpleLayuot();
var consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.Treshold = ReportLevel.Error;
var logger = new Logger(consoleAppender);
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
示例11: Main
public static void Main()
{
try
{
var simpleLayout = new SimpleLayout();
var xmlLayout = new XmlLayout();
IAppender consoleAppender = new ConsoleAppender(simpleLayout);
IAppender fileAppender = new FileAppender(simpleLayout);
fileAppender.File = "../../log.txt";
IAppender fileAppenderXml = new FileAppender(xmlLayout);
fileAppenderXml.File = "../../log.xml";
ILogger logger = new Logger(consoleAppender, fileAppender, fileAppenderXml);
// add in logs
logger.Error("Error parsing JSON.");
logger.Info(string.Format("User {0} successfully registered.", "Pesho"));
logger.Warn("Warn - missing files.");
logger.Fatal("mscorlib.dll does not respond");
logger.Critical("No connection string found in App.config");
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine();
}
示例12: Run
public static int Run(Logger logger, int parentProcessId)
{
// get parent process which will be monitored
Process parentProcess = null;
if (parentProcessId != 0)
{
try
{
parentProcess = Process.GetProcessById(parentProcessId);
}
catch (Exception e)
{
logger.Error(e, "Cannot find parentProcess (Id={0})", parentProcessId);
return 1;
}
}
// open service
try
{
var address = "net.pipe://localhost/Unity3D.IncrementalCompiler/" + parentProcessId;
var serviceHost = new ServiceHost(typeof(CompilerService));
var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None)
{
MaxBufferSize = 1048576,
MaxReceivedMessageSize = 1048576
};
serviceHost.AddServiceEndpoint(typeof(ICompilerService), binding, address);
serviceHost.Open();
}
catch (Exception e)
{
logger.Error(e, "Service Host got an error");
return 1;
}
if (parentProcess != null)
{
parentProcess.WaitForExit();
logger.Info("Parent process just exited. (PID={0})", parentProcess.Id);
}
return 0;
}
示例13: DvseSerialEdlComThread
/// <summary>
/// Initializes a new instance of the <see cref="DvseSerialEdlComThread"/> class.
/// </summary>
/// <param name="portName">Name of the port.</param>
public DvseSerialEdlComThread(string portName)
{
logger = LogManager.GetLogger(portName);
Trace.WriteLine($"------ {DateTime.Now} Creating serial com thread for port [{portName}].");
logger.Info("Creating serial com thread for port [{0}].", portName);
// Check if com port exisists.
if (machinePorts.Contains(portName) == false)
{
logger.Error("On this machine no COM port '{0}' found.", portName);
throw new FaultException($"On this machine no COM port '{portName}' found.");
}
ActiveTariffWrittenAt = new DateTime(0);
OperationModeWrittenAt = new DateTime(0);
this.portName = portName;
logger.Info("Serial com thread for port [{0}] created.", portName);
}
示例14: Main
public static void Main()
{
var simpleLayout = new SimpleLayout();
var jsonLayout = new JsonLayout();
// var myLayout = new SoftUniLayout();
var consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.ReportLevel = ReportLevel.Error;
consoleAppender.ReportLevel = ReportLevel.Error;
var fileAppender = new FileAppendder(jsonLayout, "../../Log.txt");
fileAppender.ReportLevel = ReportLevel.Error;
var logger = new Logger(consoleAppender, fileAppender);
logger.Error("Error parsing JSON.");
logger.Warning("User John successfully registered");
logger.Info("Everything seems fine");
logger.Warning("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
fileAppender.Close();
}
示例15: PassNullParameterToLoggerInfo_ThrowException
public void PassNullParameterToLoggerInfo_ThrowException()
{
var logger = new Logger(new ConsoleAppender(new SimpleLayout()));
logger.Info(null);
}