本文整理汇总了C#中System.Logger.Debug方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.Debug方法的具体用法?C# Logger.Debug怎么用?C# Logger.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Logger
的用法示例。
在下文中一共展示了Logger.Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Humidity_Air_HIH4000
public Humidity_Air_HIH4000(string Name, bool Simulation, Adc_MCP3208 adc, int channel, Logger Logger)
: base(Name, Simulation, Logger)
{
logger.Debug("Humidity_Air_HIH4000-Constructor_00");
logger = Logger;
logger.Debug("Humidity_Air_HIH4000-Constructor_10");
this.Adc = adc;
logger.Debug("Humidity_Air_HIH4000-Constructor_11");
MinValue = 0;
MaxValue = 100;
AlarmMin = MinValue;
AlarmMax = MaxValue;
voltage = 3.3;
Channel = channel;
firstValue = true;
if (Simulation)
SetFirstValue();
Initialization();
logger.Debug("Humidity_Air_HIH4000-Constructor_99");
}
示例2: CSharpProject
public CSharpProject(ISolution solution,
Logger logger,
string folderPath,
IFileSystem fileSystem)
: base(fileSystem, logger)
{
_fileSystem = fileSystem;
_logger = logger;
_solution = solution;
Files = new List<CSharpFile>();
References = new List<IAssemblyReference>();
DirectoryInfoBase folder;
try
{
folder = _fileSystem.DirectoryInfo.FromDirectoryName(folderPath);
}
catch (DirectoryNotFoundException)
{
logger.Error("Directory not found - " + folderPath);
return;
}
var files = folder.GetFiles("*.cs", SearchOption.AllDirectories);
foreach (var file in files)
{
_logger.Debug("Loading " + file.FullName);
Files.Add(new CSharpFile(this, file.FullName));
}
this.ProjectContent = new CSharpProjectContent()
.SetAssemblyName(AssemblyName)
.AddAssemblyReferences(References)
.AddOrUpdateFiles(Files.Select(f => f.ParsedFile));
AddMsCorlib();
AddReference(LoadAssembly(FindAssembly("System.Core")));
var dlls = folder.GetFiles("*.dll", SearchOption.AllDirectories);
foreach (var dll in dlls)
{
_logger.Debug("Loading assembly " + dll.FullName);
AddReference(dll.FullName);
}
}
示例3: HOOService
public HOOService(object dep)
{
log = new Logger("HOO.SvcLib", this.GetType());
log.Entry.MethodName = "Constructor";
log.Entry.StepName = "Start";
log.Debug(dep.ToString());
if (dep is List<Universe>)
this.World = (List<Universe>)dep;
}
示例4: DebugDoesNotLogWhenLogLevelAtInformation
public async Task DebugDoesNotLogWhenLogLevelAtInformation()
{
// Arrange
Logger logger = new Logger(_runtimeEnvironment.Object, _queue.Object, _source.Object, _extension.Object, LogLevelEnum.Information, _correlationIdProvider.Object);
// Act
await logger.Debug("a message");
// Assert
_queue.Verify(x => x.EnqueueAsync(It.IsAny<LogQueueItem>()), Times.Never);
}
示例5: Debug_WithoutWriter
public void Debug_WithoutWriter()
{
// arrange
var logger = new Logger();
// act
var ex = Assert.Throws<Exception>(() => logger.Debug("debug message"));
// assert
Assert.Equal("The writer must be set with the 'SetWriter' method first.", ex.Message);
}
示例6: Debug_WithoutCategoryAdded
public void Debug_WithoutCategoryAdded()
{
// arrange
var logger = new Logger();
var logs = new StringBuilder();
logger.SetWriter(new StringWriter(logs));
// act
logger.Debug("debug message");
// assert
Assert.Equal(string.Empty, logs.ToString());
}
示例7: HouseKeepingHandler
public HouseKeepingHandler(TCPWrapper MyTCPWrapper, MySqlManager MyMySqlManager, Logger MyLogger, errorHandler MyErrorHandler)
{
this.TheLogger = MyLogger;
this.TheMySqlManager = MyMySqlManager;
this.TheTCPWrapper = MyTCPWrapper;
this.TheErrorHandler = MyErrorHandler;
TheTCPWrapper = MyTCPWrapper;
TheMySqlManager = MyMySqlManager;
TheLogger.Debug("New HouseKeepingTimer.Interval: " + this.HouseKeepingTimer.Interval + "\n");
HouseKeepingTimer.Elapsed += new ElapsedEventHandler(HouseKeepingTimer_Tick);
TheTCPWrapper.GotConnected += new TCPWrapper.GotConnectedEventHandler(OnGotConnected);
TheTCPWrapper.GotDisconnected += new TCPWrapper.GotDisconnectedEventHandler(OnGotDisconnected);
}
示例8: Error
public void Error()
{
// arrange
var logger = new Logger();
var logs = new StringBuilder();
logger.SetWriter(new StringWriter(logs));
logger.AddCategory("error");
// act
logger.Debug("debug message");
logger.Info("info message");
logger.Error("error message");
// assert
Assert.Equal("error message", logs.ToString().Trim());
}
示例9: Logger_Debug
public void Logger_Debug()
{
const string message = "message";
int counter = 0;
ILogger logger = new Logger();
(logger as Logger).OnCritical = s => Assert.Fail();
(logger as Logger).OnError = s => Assert.Fail();
(logger as Logger).OnWarning = s => Assert.Fail();
(logger as Logger).OnInformational = s => Assert.Fail();
(logger as Logger).OnDebug = s => counter++;
(logger as Logger).OnDiagnostic = s => Assert.Fail();
(logger as Logger).OnChangeEvent = (a, b) => Assert.Fail();
logger.Debug(message);
Assert.AreEqual(1, counter);
}
示例10: Temperature_DS1822
/// <summary>
/// Costruttore senza ID del sensore, trovato automaticamente dal software
/// Prende il primo termometro che trova
/// </summary>
/// <param name="Name"></param>
/// <param name="Simulation"></param>
/// <param name="Logger"></param>
public Temperature_DS1822(string Name, bool Simulation, Logger Logger)
: base(Name, Simulation, Logger)
{
Logger.Debug("Temperature_DS1822_Constructor senza ID. SensorId automatico");
if (!Simulation)
{
// creazione del termometro; se il parametro DeviceIndex = 0 usa il primo sensore che trova
try
{
termometro = new Ds18b20Connection(0);
}
catch (Exception ex)
{
Logger.Error("Temperature_DS1822_Constructor senza ID. " + ex.Message);
return;
}
}
Initialization();
}
示例11: TestLogging
public void TestLogging()
{
var config = new FileConfiguration
{
CreateDateFolder = true,
DaysToKeep = 3,
Path = AppDomain.CurrentDomain.BaseDirectory
};
var target = new FileTarget("Everything", config);
target.Enqueue(new LogEntry
{
CreatedAt = DateTime.Now,
LogLevel = LogLevel.Debug,
Message = "Hello world",
LoggedType = GetType(),
MethodName = MethodBase.GetCurrentMethod().Name,
ThreadId = Thread.CurrentThread.ManagedThreadId,
UserName = Thread.CurrentPrincipal.Identity.Name
?? Environment.UserName
});
var target2 = new PaddedFileTarget("EVeryone", config);
target2.Enqueue(new LogEntry
{
CreatedAt = DateTime.Now,
LogLevel = LogLevel.Debug,
Message = "Hello world",
LoggedType = GetType(),
MethodName = MethodBase.GetCurrentMethod().Name,
ThreadId = Thread.CurrentThread.ManagedThreadId,
UserName = Thread.CurrentPrincipal.Identity.Name
?? Environment.UserName
});
var logger = new Logger(GetType(), new[] {target2, target});
logger.Info("Hello");
logger.Debug("Hello");
logger.Warning("Hello");
logger.Error("Hello");
}
示例12: AdvertHandler
public AdvertHandler(TCPWrapper MyTCPWrapper, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, Inventory MyInventory, errorHandler MyErrorHandler)
{
Random RandomClass = new Random();
int i;
this.TheLogger = MyLogger;
this.TheMySqlManager = MyMySqlManager;
this.TheTCPWrapper = MyTCPWrapper;
this.TheTradeHandler = MyTradeHandler;
this.TheInventory = MyInventory;
this.TheErrorHandler = MyErrorHandler;
TheTCPWrapper = MyTCPWrapper;
TheMySqlManager = MyMySqlManager;
TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);
if (TheMySqlManager.advertise())
{
this.AdvertTimer.Interval = 1000;
if (TheMySqlManager.advertchannel(Settings.botid) != 99999999)
{
//if (TheMySqlManager.lastadverttime(Settings.botid) + TheMySqlManager.minadverttime() <= DateTime.Now )
if (TheMySqlManager.lastadverttime(Settings.botid) <= TheMySqlManager.minadverttime())
{
i = TheMySqlManager.minadverttime() * 1000;
i += (RandomClass.Next(0, TheMySqlManager.randomadvertdelay()) * 1000);
if (i < 900000)
i = 900000;//minimum 15 minute delay
this.AdvertTimer.Interval = i;
}
}
}
else
{
this.AdvertTimer.Interval = 900000;
}
TheLogger.Debug("New AdvertTimer.Interval: " + this.AdvertTimer.Interval + "\n");
AdvertTimer.Elapsed += new ElapsedEventHandler(AdvertTimer_Tick);
TheTCPWrapper.GotConnected += new TCPWrapper.GotConnectedEventHandler(OnGotConnected);
TheTCPWrapper.GotDisconnected += new TCPWrapper.GotDisconnectedEventHandler(OnGotDisconnected);
}
示例13: TestLogging
public void TestLogging()
{
var config = new FileConfiguration
{
CreateDateFolder = true,
DaysToKeep = 3,
Path = @"d:\logfiles"
};
var target = new FileTarget("Everything", config);
target.Enqueue(new LogEntry
{
CreatedAt = DateTime.Now,
LogLevel = LogLevel.Debug,
Message = "Hello world",
StackFrames = new StackTrace().GetFrames(),
ThreadId = Thread.CurrentThread.ManagedThreadId,
UserName = Thread.CurrentPrincipal.Identity.Name
?? Environment.UserName
});
var target2 = new PaddedFileTarget("EVeryone", config);
target2.Enqueue(new LogEntry
{
CreatedAt = DateTime.Now,
LogLevel = LogLevel.Debug,
Message = "Hello world",
StackFrames = new StackTrace().GetFrames(),
ThreadId = Thread.CurrentThread.ManagedThreadId,
UserName = Thread.CurrentPrincipal.Identity.Name
?? Environment.UserName
});
var logger = new Logger(GetType(), new[] {target2, target});
logger.Info("Hello");
logger.Debug("Hello");
logger.Warning("Hello");
logger.Error("Hello");
}
示例14: AltAdvertHandler
public AltAdvertHandler(TCPWrapper MyTCPWrapper, MySqlManager MyMySqlManager, Logger MyLogger, TradeHandler MyTradeHandler, Inventory MyInventory, errorHandler MyErrorHandler)
{
Random RandomClass = new Random();
int i;
this.TheLogger = MyLogger;
this.TheMySqlManager = MyMySqlManager;
this.TheTCPWrapper = MyTCPWrapper;
this.TheTradeHandler = MyTradeHandler;
this.TheInventory = MyInventory;
this.TheErrorHandler = MyErrorHandler;
TheTCPWrapper = MyTCPWrapper;
TheMySqlManager = MyMySqlManager;
uint altadvertchannel = TheMySqlManager.altadvertchannel(Settings.botid);
this.AltAdvertTimer.Interval = 900000;
if (TheMySqlManager.altadvertise())
{
this.AltAdvertTimer.Interval = 1000;
if (altadvertchannel != 99999999)
{
if (TheMySqlManager.lastaltadverttime(Settings.botid) <= TheMySqlManager.minaltadverttime())
{
i = TheMySqlManager.minaltadverttime() * 1000;
i += (RandomClass.Next(0, TheMySqlManager.randomaltadvertdelay()) * 1000);
if (i < 900000)
i = 900000;//minimum 15 minute delay
this.AltAdvertTimer.Interval = i;
}
}
}
TheLogger.Debug("New AltAdvertTimer.Interval: " + this.AltAdvertTimer.Interval + "\n");
if (altadvertchannel != 99999999 && TheMySqlManager.lastaltadverttime(Settings.botid) < TheMySqlManager.minaltadverttime() && MainClass.serverName != "test")
return;
AltAdvertTimer.Elapsed += new ElapsedEventHandler(AltAdvertTimer_Tick);
TheTCPWrapper.GotConnected += new TCPWrapper.GotConnectedEventHandler(OnGotConnected);
TheTCPWrapper.GotDisconnected += new TCPWrapper.GotDisconnectedEventHandler(OnGotDisconnected);
}
示例15: Execute
public void Execute(Logger log)
{
if (File.Exists(_filePath)) {
using (StreamReader reader = new StreamReader(File.OpenRead(_filePath))) {
_contents.Append(reader.ReadToEnd());
reader.Close();
}
} else {
log.Debug("{1}: File {0} does not exist.", _filePath, Name);
}
}