-
Notifications
You must be signed in to change notification settings - Fork 11
DataCollector logging
PalinaSh edited this page Jun 14, 2023
·
3 revisions
NLog is used by default. Default settings are:
- WriteDebug = false
- ConfigPath = "collector.nlog.config"
var collectorOptions = new CollectorOptions()
{
AccessKey = "e6150991-08a8-48dc-8152-0458715a1e3c", //should be changed
ServerAddress = "https://localhost",
};
var collector = new DataCollector(collectorOptions).AddNLog();You can change the default NLog settings the next way:
var collectorOptions = new CollectorOptions()
{
AccessKey = "e6150991-08a8-48dc-8152-0458715a1e3c", //should be changed
ServerAddress = "https://localhost",
};
var loggerOptions = new LoggerOptions()
{
ConfigPath = "logger.config";
WriteDebug = true,
};
var collector = new DataCollector(collectorOptions).AddNLog(loggerOptions);You can use your custom logger. It should implement interface ICollectorLogger.
internal sealed class CustomLogger : ICollectorLogger
{
public void Debug(string message) => Console.WriteLine($"Debug: {message}");
public void Info(string message) => Console.WriteLine($"Info: {message}");
public void Error(string message) => Console.WriteLine($"Error: {message}");
public void Error(Exception ex) => Console.WriteLine($"Exception: {ex.Message}");
}
var collectorOptions = new CollectorOptions()
{
AccessKey = "e6150991-08a8-48dc-8152-0458715a1e3c", //should be changed
ServerAddress = "https://localhost",
};
var collector = new DataCollector(collectorOptions).AddCustomLogger(new CustomLogger());Getting Started
🔔 Alerts
📲 Telegram
HSM DataCollector (NuGet)
- Overview & API
- Quick Start
- Logging
- Statuses
- Sensor Settings
- Default sensors
HSM DataCollector (C++)
HSM Web UI
Grafana