mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 15:22:27 +02:00
RobustToolbox projects should be named Robust.* This PR changes the RobustToolbox projects from SS14.* to Robust.* Updates SS14.* prefixes/namespaces to Robust.* Updates SpaceStation14.sln to RobustToolbox.sln Updates MSBUILD/SS14.* to MSBUILD/Robust.* Updates CSProject and MSBuild references for the above Updates git_helper.py Removes Runserver and Runclient as they are unusable
35 lines
968 B
C#
35 lines
968 B
C#
using Robust.Shared.Interfaces.Log;
|
|
using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.Log
|
|
{
|
|
public sealed class FileLogHandler : ILogHandler, IDisposable
|
|
{
|
|
private readonly TextWriter writer;
|
|
|
|
public FileLogHandler(string path)
|
|
{
|
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
|
writer = TextWriter.Synchronized(new StreamWriter(path, true, EncodingHelpers.UTF8));
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
writer.Dispose();
|
|
}
|
|
|
|
public void Log(in LogMessage message)
|
|
{
|
|
var name = message.LogLevelToName();
|
|
writer.WriteLine("{0:o} [{1}] {2}: {3}", DateTime.Now, name, message.SawmillName, message.Message);
|
|
|
|
// This probably isn't the best idea.
|
|
// Remove this flush if it becomes a problem (say performance).
|
|
writer.Flush();
|
|
}
|
|
}
|
|
}
|