本文整理汇总了C#中ILogger.Debug方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.Debug方法的具体用法?C# ILogger.Debug怎么用?C# ILogger.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connection
public Connection(IPAddress address, TransportConfig config, ILogger logger)
{
Endpoint = address;
_config = config;
_logger = logger;
_tcpClient = new TcpClient();
_tcpClient.Connect(address, _config.Port);
Stream stream = _tcpClient.GetStream();
#if DEBUG_STREAM
stream = new DebugStream(stream);
#endif
_outputStream = stream;
_inputStream = stream;
for (byte idx = 0; idx < STREAMID_MAX; ++idx)
{
_availableStreamIds.Push(idx);
_requestStates[idx].Lock = new object();
}
_logger.Debug("Ready'ing connection for {0}", Endpoint);
GetOptions();
ReadifyConnection();
_logger.Debug("Connection to {0} is ready", Endpoint);
}
示例2: Connection
public Connection(IPAddress address, TransportConfig config, ILogger logger)
{
Endpoint = address;
_config = config;
_logger = logger;
_tcpClient = new TcpClient();
_tcpClient.Connect(address, _config.Port);
_streaming = config.Streaming;
Stream stream = _tcpClient.GetStream();
#if DEBUG_STREAM
stream = new DebugStream(stream);
#endif
_outputStream = stream;
_inputStream = stream;
for (byte idx = 0; idx < MAX_STREAMID; ++idx)
{
_availableStreamIds.Push(idx);
}
// start a new read task
Task.Factory.StartNew(ReadNextFrameHeader, _cancellation.Token);
// readify the connection
_logger.Debug("Readyfying connection for {0}", Endpoint);
GetOptions();
ReadifyConnection();
_logger.Debug("Connection to {0} is ready", Endpoint);
}
示例3: Main
// "main" scene constructor. The constructor is called by the server when the scene is created.
//
public Main(ISceneHost scene)
{
_scene = scene;
_env = _scene.GetComponent<IEnvironment>();
_log = _scene.GetComponent<ILogger>();
_log.Debug("server", "starting configuration");
// we configure the functions that will be called by the Connecting, Connected and Disconnected events.
// Connecting is called when a client tries to connect to the server. Please use this event to prevent player form accessing the server.
// Connected is called when a client is already connected.
// Disconnected is called when a client is already disconnected.
_scene.Connecting.Add(OnConnecting);
_scene.Connected.Add(OnConnected);
_scene.Disconnected.Add(OnDisconnect);
// We configure the routes and procedure the client can use.
// A route is used for "one-shot" messages that don't need response such as position updates.
// Produres send a response to the client. It's better to use them when client have to wait for a response from the server such as being hit.
// Procedures use more bandwidth than regular routes.
//
// In our case, the server mostly has procedures as the client always needs to wait for a response from the server since it controls the game.
_scene.AddProcedure("play", OnPlay);
_scene.AddProcedure("click", OnClick);
_scene.AddProcedure("update_leaderBoard", OnUpdateLeaderBoard);
// this route is only used by the client to disconnect from the game (not the server) because it doesn't have to wait for the server to stop playing.
_scene.AddRoute("exit", OnExit);
//The starting and shutdown event are called when the scene is launched and shut down. these are useful if you need to initiate the server logic or save the game state before going down.
_scene.Starting.Add(OnStarting);
_scene.Shuttingdown.Add(OnShutdown);
_log.Debug("server", "configuration complete");
}
示例4: DebugWrite
public void DebugWrite(ILogger logger)
{
if (logger == null) throw new ArgumentNullException("logger");
logger.Debug("TestFileCollection.UnitTestProvider = {0}".FormatWith(UnitTestProvider));
logger.Debug("TestFileCollection.MSTestVersion = {0}".FormatWith(MSTestVersion));
logger.Debug("TestFileCollection.TestAssembly = {0}".FormatWith(TestAssemblyFullName));
}
示例5: RemoveAllExistingNamespaceElements
/// <summary>
/// Danger! Danger, Will Robinson!
/// </summary>
private static void RemoveAllExistingNamespaceElements(Func<NamespaceManager> namespaceManager, ILogger logger)
{
logger.Debug("Removing all existing namespace elements. IMPORTANT: This should only be done in your regression test suites.");
var queueDeletionTasks = namespaceManager().GetQueues()
.Select(q => q.Path)
.Select(queuePath => Task.Run(async delegate
{
logger.Debug("Deleting queue {0}", queuePath);
await namespaceManager().DeleteQueueAsync(queuePath);
}))
.ToArray();
var topicDeletionTasks = namespaceManager().GetTopics()
.Select(t => t.Path)
.Select(topicPath => Task.Run(async delegate
{
logger.Debug("Deleting topic {0}", topicPath);
await namespaceManager().DeleteTopicAsync(topicPath);
}))
.ToArray();
var allDeletionTasks = new Task[0]
.Union(queueDeletionTasks)
.Union(topicDeletionTasks)
.ToArray();
Task.WaitAll(allDeletionTasks);
}
示例6: Connection
public Connection(IPAddress address, TransportConfig config, ILogger logger, IInstrumentation instrumentation)
{
Endpoint = address;
_config = config;
_logger = logger;
_instrumentation = instrumentation;
_tcpClient = new TcpClient();
_tcpClient.Connect(address, _config.Port);
_streaming = config.Streaming;
for (byte idx = 0; idx < MAX_STREAMID; ++idx)
{
_availableStreamIds.Push(idx);
}
_socket = _tcpClient.Client;
// start a new read task
Task.Factory.StartNew(ReadNextFrameHeader, _cancellation.Token);
// readify the connection
_logger.Debug("Readyfying connection for {0}", Endpoint);
//GetOptions();
ReadifyConnection();
_logger.Debug("Connection to {0} is ready", Endpoint);
}
示例7: TestInitialize
public void TestInitialize()
{
container = new WindsorContainer();
RegisterServices(container);
logger = container.Resolve<ILoggerFactory>().Create(this.GetType());
logger.Debug("Begin BeforeEachTest()");
BeforeEachTest();
logger.Debug("Begin [TestMethod]");
}
示例8: DefaultRetry
public DefaultRetry(ILogger logger) : base(_numAttempts)
{
this
.Chain(r => r.Started += (s, e) => logger.Debug("{Action}...", e.ActionName))
.Chain(r => r.Success += (s, e) => logger.Debug("{Action} completed successfully in {Elapsed}.", e.ActionName, e.ElapsedTime))
.Chain(r => r.TransientFailure += (s, e) => logger.Warn(e.Exception, "A transient failure occurred in action {Action}.", e.ActionName))
.Chain(r => r.PermanentFailure += (s, e) => logger.Error(e.Exception, "A permanent failure occurred in action {Action}.", e.ActionName))
.WithBackoff<DefaultRetry>(Backoff)
;
}
示例9: Crawler
public Crawler(ILogger logger, IEnumerable<CrawlJob> crawlJobs)
{
Logger = logger;
CrawlJobs = crawlJobs;
logger.Info("Web Spider instantiated...");
if (logger.IsDebugEnabled) {
logger.Debug("List of URLs to index:");
foreach (CrawlJob u in crawlJobs)
logger.Debug(string.Format(" > {0}", u.Url.ToString()));
}
}
示例10: Versioner
public Versioner(ISession session, ILogger<Version> logger)
{
_logger = logger;
_logger.Debug("Define global mappings");
MappingConfiguration.Global.Define<PocoMapper>();
_logger.Debug("Create mapper and table instances");
_mapper = new Mapper(session);
var table = new Table<DatabaseVersion>(session);
table.CreateIfNotExists();
}
示例11: WebServerNotAvailable
public WebServerNotAvailable(ILogger logger, int port = 80)
{
_logger = logger;
_port = port;
_logger.Debug("Starting NOT AVAILABLE web server");
_listeningSocket = SetupListeningSocket();
_requestThread = new Thread(WaitForNetworkRequest);
_requestThread.Start();
_logger.Debug("NOT AVAILABLE web server is running");
}
示例12: SaveEmailInData
public void SaveEmailInData(MailBox mailbox, MailMessageItem message, ILogger log)
{
if (string.IsNullOrEmpty(mailbox.EMailInFolder))
return;
try
{
foreach (var attachment in message.Attachments)
{
using (var file = AttachmentManager.GetAttachmentStream(attachment))
{
log.Debug("SaveEmailInData->ApiHelper.UploadToDocuments(fileName: '{0}', folderId: {1})",
file.FileName, mailbox.EMailInFolder);
UploadToDocuments(file, attachment.contentType, mailbox, log);
}
}
}
catch (Exception e)
{
_log.Error("SaveEmailInData(tenant={0}, userId='{1}', messageId={2}) Exception:\r\n{3}\r\n",
mailbox.TenantId, mailbox.UserId, message.Id, e.ToString());
}
}
示例13: ExecuteTool
public static bool ExecuteTool(ILogger logger, string toolName, string arguments, string workingDirectory, Action<ILogger, string> processToolOutput = null)
{
try {
if (processToolOutput == null)
processToolOutput = (l, s) => l.Info(s);
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = toolName.FindInPathEnvironmentVariable();
p.StartInfo.Arguments = arguments;
p.StartInfo.WorkingDirectory = workingDirectory;
p.StartInfo.CreateNoWindow = true;
if (logger != null) {
p.OutputDataReceived += (object sender, DataReceivedEventArgs e) => processToolOutput(logger, e.Data);
p.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => logger.Error(e.Data);
}
var debugLine = "Executing: " + p.StartInfo.FileName + " " + arguments;
logger.Debug(debugLine);
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();
p.WaitForExit();
return p.ExitCode == 0;
} catch (Exception e) {
logger.Error(e);
}
return false;
}
示例14: Execute
public virtual void Execute(JobExecutionContext context)
{
Logger = new ServiceLogger(context.JobDetail.Name);
if (Monitor.TryEnter(SYNC_LOCK, 3000) == false)
{
Logger.Debug("上一次调度未完成,本次调度放弃运行");
return;
}
try
{
Logger.Info("调度开始执行");
InnerExecute(context);
Logger.Info("调度正常结束");
}
catch (Exception e)
{
Logger.Error("调度执行时发生异常: " + e);
}
finally
{
Monitor.Exit(SYNC_LOCK);
}
}
示例15: WebServer
public WebServer(ILogger logger, IGarbage garbage, int port = 80)
{
_logger = logger;
_garbage = garbage;
_port = port;
_logger.Debug("Starting web server");
_responses = new ArrayList();
_listeningSocket = SetupListeningSocket();
_requestThread = new Thread(WaitForNetworkRequest);
_requestThread.Start();
_logger.Debug("Web server is running");
}