mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-17 11:23:00 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace CryptoExchange.Net.Logging
|
||||
{
|
||||
public class DebugTextWriter: TextWriter
|
||||
{
|
||||
public override Encoding Encoding => Encoding.ASCII;
|
||||
|
||||
public override void WriteLine(string value)
|
||||
{
|
||||
Debug.WriteLine(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace CryptoExchange.Net.Logging
|
||||
{
|
||||
public class Log
|
||||
{
|
||||
public TextWriter TextWriter { get; internal set; } = new DebugTextWriter();
|
||||
public LogVerbosity Level { get; internal set; } = LogVerbosity.Warning;
|
||||
|
||||
public void Write(LogVerbosity logType, string message)
|
||||
{
|
||||
if ((int)logType >= (int)Level)
|
||||
TextWriter.WriteLine($"{DateTime.Now:hh:mm:ss:fff} | {logType} | {message}");
|
||||
}
|
||||
}
|
||||
|
||||
public enum LogVerbosity
|
||||
{
|
||||
Debug,
|
||||
Warning,
|
||||
Error,
|
||||
None
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user