mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +08:00
Use Logger for squirrel update logs
This commit is contained in:
parent
c04cdd170a
commit
c01841d7d7
@ -2,8 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -169,23 +167,14 @@ namespace osu.Desktop.Updater
|
|||||||
|
|
||||||
private class SquirrelLogger : Splat.ILogger, IDisposable
|
private class SquirrelLogger : Splat.ILogger, IDisposable
|
||||||
{
|
{
|
||||||
private readonly string path;
|
|
||||||
private readonly object locker = new object();
|
|
||||||
public LogLevel Level { get; set; } = LogLevel.Info;
|
public LogLevel Level { get; set; } = LogLevel.Info;
|
||||||
|
|
||||||
public SquirrelLogger()
|
|
||||||
{
|
|
||||||
var file = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location ?? Directory.GetCurrentDirectory()), "SquirrelSetupUpdater.log");
|
|
||||||
if (File.Exists(file)) File.Delete(file);
|
|
||||||
path = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Write(string message, LogLevel logLevel)
|
public void Write(string message, LogLevel logLevel)
|
||||||
{
|
{
|
||||||
if (logLevel < Level)
|
if (logLevel < Level)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (locker) File.AppendAllText(path, message + "\r\n");
|
Logger.Log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
Loading…
Reference in New Issue
Block a user