本文整理汇总了C#中ILog.Debug方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.Debug方法的具体用法?C# ILog.Debug怎么用?C# ILog.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILog
的用法示例。
在下文中一共展示了ILog.Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Finish
public void Finish(ILog log, string header)
{
if (log == null)
{
return;
}
lock (_markers)
{
var duration = GetDuration();
// XXX check log duration threshold (once we have one)
log.Debug(@"({0:ss\.ffff} seconds) {1}", duration, header);
var previous_time = _markers.First().Time;
foreach (var marker in _markers)
{
duration = new TimeSpan(marker.Time - previous_time);
previous_time = marker.Time;
log.Debug(" {0:ss\\.ffff} [{1:00}] {2}",
duration, marker.ThreadId, marker.Name);
};
}
}
示例2: 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");
}
示例3: CopyFiles
/// <summary>
/// Copy all files from source directory except for the exclusions
/// </summary>
public static void CopyFiles(ILog log, string sourceDirectory, string destinationDirectory, IEnumerable<string> excludes, bool recursive = false)
{
var files = Directory.GetFiles(sourceDirectory, "*.*");
foreach (var file in files.Where(
x =>
{
foreach (var exclude in excludes)
{
if (x.EndsWith(exclude))
{
return false;
}
}
return true;
}))
{
try
{
var source = file;
var destination = Path.Combine(destinationDirectory, new FileInfo(file).Name);
if (!Directory.Exists(destinationDirectory))
{
Directory.CreateDirectory(destinationDirectory);
log.Debug(destinationDirectory);
}
SetWritable(log, destination);
log.Debug("Writing file: " + source + " to " + destination);
File.Copy(source, destination, true);
}
catch (System.UnauthorizedAccessException unauth)
{
log.Error("System.UnauthorizedAccessException:" + unauth.Message);
}
catch (IOException ioException)
{
log.Error("System.IO.IOException:" + ioException.Message);
}
}
if (!recursive)
{
return;
}
var dirs = Directory.GetDirectories(sourceDirectory);
foreach (var dir in dirs)
{
var dirInfo = new DirectoryInfo(dir);
CopyFiles(log, dir, Path.Combine(destinationDirectory, dirInfo.Name), excludes, true);
}
}
示例4: QuartzService
/// <summary>
/// Initializes a new instance of the <see cref="QuartzService"/> class.
/// </summary>
public QuartzService()
{
logger = LogManager.GetLogger(GetType());
logger.Debug("Obtaining instance of an IQuartzServer");
server = QuartzServerFactory.CreateServer();
logger.Debug("Initializing server");
server.Initialize();
logger.Debug("Server initialized");
}
示例5: Init
public virtual void Init()
{
Log = LogManager.GetCurrentClassLogger();
Log.Debug("初始化必须的对象 ----->");
HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
//HibernatingRhinos.NHibernate.Profiler.Appender.NHibernateProfiler.Initialize();
var config = new AspMvcConfig();
//MvcConfig.RootContext.
Scope = new SessionScope("MySessionFactory".GetInstance<ISessionFactory>(), true);
Log.Debug("测试开始 ----->");
}
示例6: Intercept
public void Intercept(IInvocation invocation)
{
_logger = _logFactory.GetLogger(invocation.TargetType);
if (_logger.IsDebugEnabled) _logger.Debug(_invocationLogStringBuilder.BuildLogString(invocation, InvocationPhase.Start) );
try
{
invocation.Proceed();
if (_logger.IsDebugEnabled) _logger.Debug(_invocationLogStringBuilder.BuildLogString(invocation, InvocationPhase.End));
}
catch (Exception ex)
{
if (_logger.IsErrorEnabled) _logger.Error(_invocationLogStringBuilder.BuildLogString(invocation, InvocationPhase.Error), ex);
throw;
}
}
示例7: WriteLog
/// <summary>
/// 执行前日志
/// </summary>
private void WriteLog( ActionExecutingContext context ) {
Log = Logs.Log4.Log.GetContextLog( context.Controller );
Log.Method = context.ActionDescriptor.ActionName;
AddParams( context.ActionParameters );
Log.Debug();
Log.Start();
}
示例8: FilesWinService
public FilesWinService(ILog log, IConfig config, IFirewallService firewallService)
: base(log, true)
{
this.config = config;
this.firewallService = firewallService;
Uri baseAddress = config.FilesServiceUri;
var webHttpBinding = new WebHttpBinding();
webHttpBinding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
var serviceHost = new IocServiceHost(typeof(FilesService), baseAddress);
base.serviceHost = serviceHost;
ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(typeof(IFilesService), webHttpBinding, baseAddress);
endpoint.Behaviors.Add(new WebHttpBehavior());
ServiceCredential filesCredentials = config.FilesCredentials;
#if DEBUG
log.Debug("FilesWinService baseAddress: {0} credentials: {1}:{2}",
baseAddress, filesCredentials.Username, filesCredentials.Password);
#endif
serviceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new CustomUserNamePasswordValidator(filesCredentials);
serviceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
}
示例9: LogMetrics
private void LogMetrics(ILog log, DateTime startTime, int initialManagedItemsProcessed, TimeSpan initialElapsedTime, int managedItemsToBeProcessed)
{
if (initialManagedItemsProcessed <= 0 || managedItemsToBeProcessed <= 0)
return;
double averageProcessingTime = initialElapsedTime.TotalSeconds / initialManagedItemsProcessed;
DateTime estimatedStopTime = startTime.AddSeconds(averageProcessingTime * managedItemsToBeProcessed);
log.Debug(string.Format("Metrics: Elapsed Time = {0}; MI Count = {1:D}; AVG = {2}; Projected Finish = {3}; Actual Finish = {4}", initialElapsedTime.ToString(), initialManagedItemsProcessed, averageProcessingTime.ToString(), estimatedStopTime.ToString("HH:mm:ss"), DateTime.Now.ToString("HH:mm:ss")));
}
示例10: AsyncSocketClientTest
public AsyncSocketClientTest(ITestOutputHelper output)
{
_log = new MockLog(output);
_server = new MockTcpServer(_log);
_log.Debug("AsyncSocketClientTest: Start mock server");
_server.Start();
_client = new AsyncSocketClient("127.0.0.1", MockTcpServer.cPort);
}
示例11: TEST
public TEST()
{
_logger = new Logger();
_logger.Config.Format = "{LOG}";
_logger.Config.Filter.Tag = new[] {"task", "mail", "mediator"};
_logger.Warning("README",README.Name);
_logger.Warning("README",README.Version.ToString());
_logger.Debug("README", "=========================================");
}
示例12: NatsClient
public NatsClient(ILog log, INatsConfig natsConfig)
{
this.log = log;
this.natsHost = natsConfig.Host;
this.natsPort = natsConfig.Port;
this.natsUser = natsConfig.User;
this.natsPassword = natsConfig.Password;
uniqueIdentifier = Guid.NewGuid();
log.Debug(Resources.NatsClient_Initialized_Fmt, UniqueIdentifier, natsHost, natsPort);
}
示例13: NatsMessagingProvider
public NatsMessagingProvider(ILog log, IConfig config)
{
this.log = log;
this.natsHost = config.NatsHost;
this.natsPort = config.NatsPort;
this.natsUser = config.NatsUser;
this.natsPassword = config.NatsPassword;
uniqueIdentifier = Guid.NewGuid();
log.Debug(Resources.NatsMessagingProvider_Initialized_Fmt, UniqueIdentifier, natsHost, natsPort);
}
示例14: Dispatcher
public Dispatcher(IAmACommandProcessor commandProcessor, IAmAMessageMapperRegistry messageMapperRegistry, IEnumerable<Connection> connections, ILog logger)
{
this.commandProcessor = commandProcessor;
this.messageMapperRegistry = messageMapperRegistry;
this.logger = logger;
State = DispatcherState.DS_NOTREADY;
Consumers = new SynchronizedCollection<Consumer>();
CreateConsumers(connections).Each(consumer => Consumers.Add(consumer));
State = DispatcherState.DS_AWAITING;
logger.Debug(m => m("Dispatcher is ready to recieve"));
}
示例15: InstanceProvider
/// <summary>
/// Initializes a new instance of the <see cref="InstanceProvider" /> class.
/// </summary>
/// <param name="serviceLocator">The service locator.</param>
/// <param name="contractType">Type of the contract.</param>
/// <param name="serviceType">Type of the service.</param>
/// <param name="tag">The tag.</param>
/// <param name="registrationType">Type of the registration.</param>
/// <exception cref="ArgumentNullException">The <paramref name="serviceLocator"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">The <paramref name="contractType"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">The <paramref name="serviceType"/> is <c>null</c>.</exception>
public InstanceProvider(IServiceLocator serviceLocator, Type contractType, Type serviceType, object tag = null, RegistrationType registrationType = RegistrationType.Singleton)
{
Argument.IsNotNull("serviceLocator", serviceLocator);
Argument.IsNotNull("contractType", contractType);
Argument.IsNotNull("serviceType", serviceType);
_log = LogManager.GetCurrentClassLogger();
_serviceLocator = serviceLocator;
_contractType = contractType;
_log.Debug("Register the contract type '{0}' for service type '{1}'", _contractType.Name, serviceType.Name);
_serviceLocator.RegisterTypeIfNotYetRegisteredWithTag(_contractType, serviceType, tag, registrationType);
}