32 lines
766 B
C#
32 lines
766 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
|
|
namespace GTPCorrgir
|
|
{
|
|
using System.Diagnostics;
|
|
|
|
public class Logger
|
|
{
|
|
public Logger()
|
|
{
|
|
string logFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logfile.log");
|
|
Trace.Listeners.Add(new TextWriterTraceListener(logFilePath));
|
|
Trace.AutoFlush = true;
|
|
}
|
|
|
|
|
|
public void Log(string message)
|
|
{
|
|
// Formato de timestamp [AAAA-MM-DD HH:mm:ss]
|
|
string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
Trace.WriteLine($"[{timestamp}] {message}");
|
|
}
|
|
}
|
|
|
|
}
|