mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-10-27 02:51:17 +00:00
ResourceServer now defaults to using TraceLogger if no logger is provided and properly awaits FetchBlobConfig. FetchBlobConfig is refactored to return a Task and handle missing configuration more gracefully. TraceLogger now writes logs to a file named after its namespace and sets up a TextWriterTraceListener for persistent logging.
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
// TraceLogger.cs (WelsonJS.Launcher)
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// SPDX-FileCopyrightText: 2025 Namhyeon Go <gnh1201@catswords.re.kr>, Catswords OSS and WelsonJS Contributors
|
|
// https://github.com/gnh1201/welsonjs
|
|
//
|
|
// We use the ICompatibleLogger interface to maintain a BCL-first style.
|
|
// This allows for later replacement with logging libraries such as ILogger or Log4Net.
|
|
//
|
|
using System.Diagnostics;
|
|
|
|
namespace WelsonJS.Launcher
|
|
{
|
|
public class TraceLogger : ICompatibleLogger
|
|
{
|
|
private static readonly string _logFileName;
|
|
|
|
static TraceLogger()
|
|
{
|
|
_logFileName = typeof(TraceLogger).Namespace + ".log";
|
|
|
|
var textWriterTraceListener = new TextWriterTraceListener(_logFileName);
|
|
Trace.Listeners.Add(textWriterTraceListener);
|
|
Trace.AutoFlush = true;
|
|
}
|
|
|
|
public void Info(string message) => Trace.TraceInformation(message);
|
|
public void Warn(string message) => Trace.TraceWarning(message);
|
|
public void Error(string message) => Trace.TraceError(message);
|
|
}
|
|
}
|