Refactor logging
This commit is contained in:
1 parent
b930588556
commit
c907ec0f44
67 files changed
+2039
-627
No files matched your search
@@ -22,7 +22,6 @@ namespace VocaluxeLib
|
||||
public static IConfig Config;
|
||||
public static ISettings Settings;
|
||||
public static IThemes Themes;
|
||||
public static ILog Log;
|
||||
public static IBackgroundMusic BackgroundMusic;
|
||||
public static IDrawing Drawing;
|
||||
public static IGraphics Graphics;
|
||||
@@ -39,14 +38,13 @@ namespace VocaluxeLib
|
||||
public static IControllers Controller;
|
||||
public static IPlaylist Playlist;
|
||||
|
||||
public static void Assign(IConfig config, ISettings settings, IThemes themes, ILog log, IBackgroundMusic backgroundMusic,
|
||||
public static void Assign(IConfig config, ISettings settings, IThemes themes, IBackgroundMusic backgroundMusic,
|
||||
IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record,
|
||||
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IControllers controller, IPlaylist playlist)
|
||||
{
|
||||
Config = config;
|
||||
Settings = settings;
|
||||
Themes = themes;
|
||||
Log = log;
|
||||
BackgroundMusic = backgroundMusic;
|
||||
Drawing = draw;
|
||||
Graphics = graphics;
|
||||
|
||||
@@ -20,6 +20,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using VocaluxeLib.Log;
|
||||
|
||||
namespace VocaluxeLib
|
||||
{
|
||||
@@ -297,7 +298,7 @@ namespace VocaluxeLib
|
||||
{
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
CBase.Log.LogError("Can't find File: " + filePath);
|
||||
CLog.Error("Can't find File: " + filePath);
|
||||
return null;
|
||||
}
|
||||
Bitmap bmp;
|
||||
@@ -307,7 +308,7 @@ namespace VocaluxeLib
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
CBase.Log.LogError("Error loading bitmap: " + filePath);
|
||||
CLog.Error("Error loading bitmap: " + filePath);
|
||||
return null;
|
||||
}
|
||||
return bmp;
|
||||
|
||||
@@ -166,16 +166,6 @@ namespace VocaluxeLib
|
||||
IMenu GetScreen(EScreen screen);
|
||||
}
|
||||
|
||||
public interface ILog
|
||||
{
|
||||
void LogError(Exception exeption, string errorText, bool showMsg = false, bool exit = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1, params object[] propertyValues);
|
||||
void LogError(string errorText, bool showMsg = false, bool exit = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1, params object[] propertyValues);
|
||||
void LogDebug(string text, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1, params object[] propertyValues);
|
||||
void LogSongWarning(string text, params object[] propertyValues);
|
||||
void LogSongError(Exception exception, string text, params object[] propertyValues);
|
||||
void LogSongError(string text, params object[] propertyValues);
|
||||
}
|
||||
|
||||
public interface IFonts
|
||||
{
|
||||
RectangleF GetTextBounds(CText text);
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Serilog;
|
||||
using VocaluxeLib.Log.Enricher;
|
||||
using VocaluxeLib.Log.Rolling;
|
||||
using VocaluxeLib.Log.Serilog;
|
||||
|
||||
namespace VocaluxeLib.Log
|
||||
{
|
||||
public static partial class CLog
|
||||
{
|
||||
private static readonly StringBuilder _MainLogStringBuilder = new StringBuilder();
|
||||
private static readonly StringWriter _MainLogStringWriter = new StringWriter(_MainLogStringBuilder);
|
||||
|
||||
private static ILogger _MainLog = new SilentLogger();
|
||||
private static ILogger _SongLog = new SilentLogger();
|
||||
private static string _LogFolder;
|
||||
|
||||
private const string _MainLogTemplate = "[{TimeStampFromStart}] [{Level}] {Message}{NewLine}{Properties}{NewLine}{Exception}";
|
||||
private const string _SongLogTemplate = "{Message}{NewLine}Additional info:{Properties}{NewLine}{Exception}";
|
||||
|
||||
public static void Init(string logFolder, string fileNameMainLog, string fileNameSongInfoLog)
|
||||
{
|
||||
_LogFolder = logFolder;
|
||||
if (!Directory.Exists(_LogFolder))
|
||||
Directory.CreateDirectory(_LogFolder);
|
||||
|
||||
LogFileRoller.RollLogs(Path.Combine(_LogFolder, fileNameMainLog), 2);
|
||||
LogFileRoller.RollLogs(Path.Combine(_LogFolder, fileNameSongInfoLog), 2);
|
||||
|
||||
_MainLog = new LoggerConfiguration()
|
||||
.Enrich.WithThreadId()
|
||||
.Enrich.FromLogContext()
|
||||
.Enrich.WithTimeStampFromStart()
|
||||
.WriteTo.TextWriter(_MainLogStringWriter, outputTemplate: _MainLogTemplate)
|
||||
// Json can be activated by adding "new CompactJsonFormatter()" as first argument
|
||||
.WriteTo.File(Path.Combine(_LogFolder, fileNameMainLog), flushToDiskInterval: TimeSpan.FromSeconds(30), outputTemplate: _MainLogTemplate)
|
||||
#if DEBUG
|
||||
.WriteTo.Console(outputTemplate: _MainLogTemplate)
|
||||
#endif
|
||||
.CreateLogger();
|
||||
|
||||
_SongLog = new LoggerConfiguration()
|
||||
.WriteTo.File(Path.Combine(_LogFolder, fileNameSongInfoLog), flushToDiskInterval: TimeSpan.FromSeconds(60), outputTemplate: _SongLogTemplate)
|
||||
#if DEBUG
|
||||
.WriteTo.Console(outputTemplate: "[SongInfo] " + _SongLogTemplate)
|
||||
#endif
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
public static void Close()
|
||||
{
|
||||
if (!(_MainLog is SilentLogger))
|
||||
{
|
||||
ILogger loggerToDispose = _MainLog;
|
||||
|
||||
_MainLog = new SilentLogger();
|
||||
(_MainLog as IDisposable)?.Dispose();
|
||||
}
|
||||
|
||||
if (!(_SongLog is SilentLogger))
|
||||
{
|
||||
ILogger loggerToDispose = _MainLog;
|
||||
|
||||
_SongLog = new SilentLogger();
|
||||
(_SongLog as IDisposable)?.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void _ShowLogAssistent(string messageTemplate, object[] propertyValues, string callerMethodeName = "", string callerFilePath = "", int callerLineNumer = -1)
|
||||
{
|
||||
//Todo: Logsend assistent
|
||||
//MessageBox.Show(messageTemplate, "Vocaluxe", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,959 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Serilog.Context;
|
||||
using Serilog.Core;
|
||||
|
||||
namespace VocaluxeLib.Log
|
||||
{
|
||||
public static partial class CLog
|
||||
{
|
||||
|
||||
public static object[] Params(params object[] propertyValues)
|
||||
{
|
||||
return propertyValues;
|
||||
}
|
||||
|
||||
|
||||
#region Verbose functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Verbose(messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level with additional propertyValues to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Verbose(messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level and associated exception to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(Exception exception, string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Verbose( exception, messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level with additional propertyValues and associated exception to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(Exception exception, string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Verbose(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Debug functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Debug(messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level with additional propertyValues to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Debug(messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level and associated exception to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(Exception exception, string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Debug( exception, messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level with additional propertyValues and associated exception to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(Exception exception, string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Debug(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Information functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Information(messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level with additional propertyValues to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Information(messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level and associated exception to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(Exception exception, string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Information( exception, messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level with additional propertyValues and associated exception to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(Exception exception, string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Information(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Warning functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Warning(messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level with additional propertyValues to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Warning(messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level and associated exception to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(Exception exception, string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Warning( exception, messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level with additional propertyValues and associated exception to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(Exception exception, string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Warning(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Error functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Error(messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level with additional propertyValues to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Error(messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level and associated exception to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(Exception exception, string messageTemplate, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Error( exception, messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level with additional propertyValues and associated exception to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(Exception exception, string messageTemplate, object[] propertyValues, bool show = false, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Error(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fatal functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(string messageTemplate, bool show = true, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Fatal(messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level with additional propertyValues to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(string messageTemplate, object[] propertyValues, bool show = true, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Fatal(messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level and associated exception to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(Exception exception, string messageTemplate, bool show = true, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Fatal( exception, messageTemplate);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level with additional propertyValues and associated exception to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(Exception exception, string messageTemplate, object[] propertyValues, bool show = true, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_MainLog.Fatal(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")]
|
||||
public static class CSongLog
|
||||
{
|
||||
|
||||
#region Verbose functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Verbose(messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level with additional propertyValues to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Verbose(messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level and associated exception to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(Exception exception, string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Verbose( exception, messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Verbose level with additional propertyValues and associated exception to the Verbose log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Verbose(Exception exception, string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Verbose(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Debug functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Debug(messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level with additional propertyValues to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Debug(messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level and associated exception to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(Exception exception, string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Debug( exception, messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Debug level with additional propertyValues and associated exception to the Debug log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Debug(Exception exception, string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Debug(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Information functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Information(messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level with additional propertyValues to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Information(messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level and associated exception to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(Exception exception, string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Information( exception, messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Information level with additional propertyValues and associated exception to the Information log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Information(Exception exception, string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Information(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Warning functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Warning(messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level with additional propertyValues to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Warning(messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level and associated exception to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(Exception exception, string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Warning( exception, messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Warning level with additional propertyValues and associated exception to the Warning log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Warning(Exception exception, string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Warning(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Error functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Error(messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level with additional propertyValues to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Error(messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level and associated exception to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(Exception exception, string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Error( exception, messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Error level with additional propertyValues and associated exception to the Error log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Error(Exception exception, string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Error(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fatal functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Fatal(messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level with additional propertyValues to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Fatal(messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level and associated exception to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(Exception exception, string messageTemplate, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Fatal( exception, messageTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the Fatal level with additional propertyValues and associated exception to the Fatal log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void Fatal(Exception exception, string messageTemplate, object[] propertyValues, [CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
_SongLog.Fatal(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Serilog.Context;
|
||||
using Serilog.Core;
|
||||
|
||||
namespace VocaluxeLib.Log
|
||||
{
|
||||
public static partial class CLog
|
||||
{
|
||||
|
||||
public static object[] Params(params object[] propertyValues)
|
||||
{
|
||||
return propertyValues;
|
||||
}
|
||||
|
||||
<# foreach (var Log in new[]{"Main","Song"}) { #>
|
||||
<# if(Log == "Song") { #>
|
||||
<# PushIndent(" "); #>
|
||||
|
||||
[SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")]
|
||||
public static class CSongLog
|
||||
{
|
||||
<# } #>
|
||||
<# foreach (var LogLevel in new[]{"Verbose","Debug", "Information", "Warning", "Error", "Fatal"}) { #>
|
||||
|
||||
#region <#= LogLevel #> functions
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the <#= LogLevel #> level to the <#= LogLevel #> log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
<# if(Log == "Main") { #>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
<# } #>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void <#= LogLevel #>(string messageTemplate, <#= Log == "Main"?(LogLevel == "Fatal"?"bool show = true, ":"bool show = false, "):"" #>[CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
<#= Log == "Main"?"_MainLog":"_SongLog" #>.<#= LogLevel #>(messageTemplate);
|
||||
}
|
||||
<# if(Log == "Main") { #>
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
<# } #>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the <#= LogLevel #> level with additional propertyValues to the <#= LogLevel #> log.
|
||||
/// </summary>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
<# if(Log == "Main") { #>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
<# } #>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void <#= LogLevel #>(string messageTemplate, object[] propertyValues, <#= Log == "Main"?(LogLevel == "Fatal"?"bool show = true, ":"bool show = false, "):"" #>[CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
<#= Log == "Main"?"_MainLog":"_SongLog" #>.<#= LogLevel #>(messageTemplate, propertyValues);
|
||||
}
|
||||
<# if(Log == "Main") { #>
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
<# } #>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the <#= LogLevel #> level and associated exception to the <#= LogLevel #> log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
<# if(Log == "Main") { #>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
<# } #>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void <#= LogLevel #>(Exception exception, string messageTemplate, <#= Log == "Main"?(LogLevel == "Fatal"?"bool show = true, ":"bool show = false, "):"" #>[CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
<#= Log == "Main"?"_MainLog":"_SongLog" #>.<#= LogLevel #>( exception, messageTemplate);
|
||||
}
|
||||
<# if(Log == "Main") { #>
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, null, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
<# } #>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an event with the <#= LogLevel #> level with additional propertyValues and associated exception to the <#= LogLevel #> log.
|
||||
/// </summary>
|
||||
/// <param name="exception">Exception of this event.</param>
|
||||
/// <param name="messageTemplate">Message template for this event.</param>
|
||||
/// <param name="propertyValues">Data inserted into the message template.</param>
|
||||
<# if(Log == "Main") { #>
|
||||
/// <param name="show">True if an message should be shown to the user, false otherwise.</param>
|
||||
<# } #>
|
||||
/// <param name="callerMethodeName">Don't use! The methode name of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerFilePath">Don't use! The filepath of the caller will be filled automatically by the compiler.</param>
|
||||
/// <param name="callerLineNumer">Don't use! The line number of the caller will be filled automatically by the compiler.</param>
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public static void <#= LogLevel #>(Exception exception, string messageTemplate, object[] propertyValues, <#= Log == "Main"?(LogLevel == "Fatal"?"bool show = true, ":"bool show = false, "):"" #>[CallerMemberName] string callerMethodeName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumer = -1)
|
||||
{
|
||||
using (LogContext.PushProperty("CallingContext", new { callerMethodeName, callerFilePath, callerLineNumer}))
|
||||
{
|
||||
<#= Log == "Main"?"_MainLog":"_SongLog" #>.<#= LogLevel #>(exception, messageTemplate, propertyValues);
|
||||
}
|
||||
<# if(Log == "Main") { #>
|
||||
if(show)
|
||||
_ShowLogAssistent(messageTemplate, propertyValues, callerMethodeName, callerFilePath, callerLineNumer);
|
||||
<# } #>
|
||||
}
|
||||
|
||||
#endregion
|
||||
<# } #>
|
||||
<# if(Log == "Song") { #>
|
||||
<# PopIndent(); #>
|
||||
}
|
||||
<# } #>
|
||||
<# } #>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using Serilog;
|
||||
using Serilog.Configuration;
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace VocaluxeLib.Log.Enricher
|
||||
{
|
||||
public static class WithTimeStampFromStartExtension
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static LoggerConfiguration WithTimeStampFromStart(this LoggerEnrichmentConfiguration enrich)
|
||||
{
|
||||
return enrich.With(new CTimeStampFromStartEnricher());
|
||||
}
|
||||
|
||||
private class CTimeStampFromStartEnricher : ILogEventEnricher
|
||||
{
|
||||
private readonly DateTimeOffset _Start = DateTimeOffset.Now;
|
||||
|
||||
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory lepf)
|
||||
{
|
||||
logEvent.AddPropertyIfAbsent(
|
||||
lepf.CreateProperty("TimeStampFromStart", logEvent.Timestamp - _Start));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace VocaluxeLib.Log.Rolling
|
||||
{
|
||||
static class LogFileRoller
|
||||
{
|
||||
public static void RollLogs(string mainLogFile, int numLogsToKeep)
|
||||
{
|
||||
_DeleteOldLogs(mainLogFile, numLogsToKeep);
|
||||
|
||||
string currentSourceFile = _GenerateRollLogFileName(mainLogFile, numLogsToKeep);
|
||||
|
||||
|
||||
for (var i = numLogsToKeep; i > 1; i--)
|
||||
{
|
||||
string currentTargetFile = currentSourceFile;
|
||||
currentSourceFile = _GenerateRollLogFileName(mainLogFile, i - 1);
|
||||
|
||||
if (File.Exists(currentSourceFile))
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Move(currentSourceFile, currentTargetFile);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Cant log anything here as the log isn't initialized yet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(mainLogFile))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (numLogsToKeep > 0)
|
||||
File.Move(mainLogFile, currentSourceFile);
|
||||
else
|
||||
File.Delete(mainLogFile);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Cant log anything here as the log isn't initialized yet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void _DeleteOldLogs(string mainLogFile, int numLogsToKeep)
|
||||
{
|
||||
Regex r = new Regex($"{Path.GetDirectoryName(mainLogFile)}\\\\{Path.GetFileNameWithoutExtension(mainLogFile)}_([0-9]+){Path.GetExtension(mainLogFile)}", RegexOptions.IgnoreCase);
|
||||
IEnumerable<string> logFiles = Directory.EnumerateFiles($"{Path.GetDirectoryName(mainLogFile)}", $"{Path.GetFileNameWithoutExtension(mainLogFile)}*{Path.GetExtension(mainLogFile)}");
|
||||
foreach (string file in logFiles)
|
||||
{
|
||||
Match m = r.Match(file);
|
||||
if (m.Success)
|
||||
{
|
||||
int logNum = -1;
|
||||
Int32.TryParse(m.Groups[1].Value, out logNum);
|
||||
|
||||
if (logNum < 0 || logNum > numLogsToKeep - 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Cant log anything here as the log isn't initialized yet
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string _GenerateRollLogFileName(string mainLogFile, int number)
|
||||
{
|
||||
return $"{Path.GetDirectoryName(mainLogFile)}\\{Path.GetFileNameWithoutExtension(mainLogFile)}_{number}{Path.GetExtension(mainLogFile)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
// From https://github.com/serilog/serilog/blob/4736691b7a0cd574e178c24a61caa8a9196a6a61/src/Serilog/Core/Pipeline/SilentLogger.cs
|
||||
|
||||
// Copyright 2013-2015 Serilog Contributors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace VocaluxeLib.Log.Serilog
|
||||
{
|
||||
class SilentLogger : ILogger
|
||||
{
|
||||
public ILogger ForContext(ILogEventEnricher enricher)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public ILogger ForContext(IEnumerable<ILogEventEnricher> enrichers)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public ILogger ForContext(string propertyName, object value, bool destructureObjects = false)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public ILogger ForContext<TSource>()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public ILogger ForContext(Type source)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Write(LogEvent logEvent)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write(LogEventLevel level, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write<T>(LogEventLevel level, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write<T0, T1>(LogEventLevel level, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write<T0, T1, T2>(LogEventLevel level, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write(LogEventLevel level, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write(LogEventLevel level, Exception exception, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write<T>(LogEventLevel level, Exception exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write<T0, T1>(LogEventLevel level, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write<T0, T1, T2>(LogEventLevel level, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Write(LogEventLevel level, Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsEnabled(LogEventLevel level)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Verbose(string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose<T>(string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose<T0, T1>(string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose<T0, T1, T2>(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose(string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose(Exception exception, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose<T>(Exception exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose<T0, T1>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose<T0, T1, T2>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Verbose(Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug(string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug<T>(string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug<T0, T1>(string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug<T0, T1, T2>(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug(string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug(Exception exception, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug<T>(Exception exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug<T0, T1>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug<T0, T1, T2>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Debug(Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information(string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information<T>(string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information<T0, T1>(string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information<T0, T1, T2>(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information(string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information(Exception exception, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information<T>(Exception exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information<T0, T1>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information<T0, T1, T2>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Information(Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning(string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning<T>(string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning<T0, T1>(string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning<T0, T1, T2>(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning(string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning(Exception exception, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning<T>(Exception exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning<T0, T1>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning<T0, T1, T2>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Warning(Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error(string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error<T>(string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error<T0, T1>(string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error<T0, T1, T2>(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error(string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error(Exception exception, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error<T>(Exception exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error<T0, T1>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error<T0, T1, T2>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Error(Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal(string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal<T>(string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal<T0, T1>(string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal<T0, T1, T2>(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal(string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal(Exception exception, string messageTemplate)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal<T>(Exception exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal<T0, T1>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal<T0, T1, T2>(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fatal(Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
}
|
||||
|
||||
[MessageTemplateFormatMethod("messageTemplate")]
|
||||
public bool BindMessageTemplate(string messageTemplate, object[] propertyValues, out MessageTemplate parsedTemplate, out IEnumerable<LogEventProperty> boundProperties)
|
||||
{
|
||||
parsedTemplate = null;
|
||||
boundProperties = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool BindProperty(string propertyName, object value, bool destructureObjects, out LogEventProperty property)
|
||||
{
|
||||
property = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Log;
|
||||
using VocaluxeLib.Menu.SingNotes;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
using VocaluxeLib.Xml;
|
||||
@@ -224,22 +225,14 @@ namespace VocaluxeLib.Menu
|
||||
msg += "the file is for newer program versions! ";
|
||||
|
||||
msg += "Current screen version is " + _ScreenVersion;
|
||||
CBase.Log.LogError(msg);
|
||||
CLog.Error(msg);
|
||||
}
|
||||
foreach (IThemeable el in _Elements.Select(_GetElement).OfType<IThemeable>())
|
||||
el.LoadSkin();
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
CBase.Log.LogError("Error while reading " + ThemeName + ".xml", true, true);
|
||||
}
|
||||
catch (CXmlException e)
|
||||
{
|
||||
CBase.Log.LogError("Error while reading " + ThemeName + ".xml: " + e, true, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError(e.Message + e.StackTrace, true, true);
|
||||
CLog.Fatal(e, "Error while reading {ThemeName}.xml", CLog.Params(ThemeName), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +261,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error while saving theme-file: " + ThemeName + " " + e.Message, true);
|
||||
CLog.Error("Error while saving theme-file: " + ThemeName + " " + e.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Log;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -57,7 +58,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
CBase.Log.LogError("Can't find " + typeof(T).Name.Substring(1) + " Element \"" + key + "\" in " + _ParentName);
|
||||
CLog.Error("Can't find " + typeof(T).Name.Substring(1) + " Element \"" + key + "\" in " + _ParentName);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Log;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Profile
|
||||
@@ -67,7 +68,7 @@ namespace VocaluxeLib.Profile
|
||||
{
|
||||
Avatar = CBase.Profiles.GetAvatarByFilename(value);
|
||||
if (Avatar == null)
|
||||
CBase.Log.LogError("Avatar '" + value + "' not found");
|
||||
CLog.Error("Avatar '" + value + "' not found");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ namespace VocaluxeLib.Profile
|
||||
{
|
||||
if (_ConvertProfile(ref e))
|
||||
return true;
|
||||
CBase.Log.LogError("Error loading profile file " + Path.GetFileName(FilePath) + ": " + e.Message);
|
||||
CLog.Error("Error loading profile file " + Path.GetFileName(FilePath) + ": " + e.Message);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -21,6 +21,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Log;
|
||||
|
||||
namespace VocaluxeLib.Songs
|
||||
{
|
||||
@@ -350,7 +351,7 @@ namespace VocaluxeLib.Songs
|
||||
for (int i = 0; i < Notes.VoiceCount; i++)
|
||||
{
|
||||
if (!Notes.VoiceNames.IsSet(i))
|
||||
CBase.Log.LogError("Warning: Can't find #P" + (i + 1) + "-tag for duets in \"" + Artist + " - " + Title + "\".");
|
||||
CLog.Error("Warning: Can't find #P" + (i + 1) + "-tag for duets in \"" + Artist + " - " + Title + "\".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using VocaluxeLib.Log;
|
||||
|
||||
namespace VocaluxeLib.Songs
|
||||
{
|
||||
@@ -121,8 +122,7 @@ namespace VocaluxeLib.Songs
|
||||
if (value == "")
|
||||
{
|
||||
_Song.UnknownTags.Add(line);
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Empty value skipped", _Song.FileName);
|
||||
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Empty value skipped", CLog.Params(_Song.FileName));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
if (useSetEncoding)
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Duplicate encoding ignored", _Song.FileName);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Duplicate encoding ignored", CLog.Params(_Song.FileName));
|
||||
continue;
|
||||
}
|
||||
sr.Dispose();
|
||||
@@ -181,7 +181,7 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
else
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] Can't find audio file: {AudioFile}", _Song.FileName, Path.Combine(_Song.Folder, value));
|
||||
CLog.CSongLog.Error("[{SongFileName}] Can't find audio file: {AudioFile}", CLog.Params(_Song.FileName, Path.Combine(_Song.Folder, value)));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@@ -192,19 +192,19 @@ namespace VocaluxeLib.Songs
|
||||
headerFlags |= EHeaderFlags.BPM;
|
||||
}
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid BPM value: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid BPM value: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "EDITION":
|
||||
if (value.Length > 1)
|
||||
_Song.Editions.Add(value);
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid edition: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid edition: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "GENRE":
|
||||
if (value.Length > 1)
|
||||
_Song.Genres.Add(value);
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid genre: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid genre: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "ALBUM":
|
||||
_Song.Album = value;
|
||||
@@ -214,13 +214,13 @@ namespace VocaluxeLib.Songs
|
||||
if (value.Length == 4 && int.TryParse(value, out num) && num > 0)
|
||||
_Song.Year = value;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid year: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid year: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "LANGUAGE":
|
||||
if (value.Length > 1)
|
||||
_Song.Languages.Add(_UnifyLanguage(value));
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid language: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid language: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "COMMENT":
|
||||
if (!String.IsNullOrEmpty(_Song._Comment))
|
||||
@@ -231,49 +231,49 @@ namespace VocaluxeLib.Songs
|
||||
if (CHelper.TryParse(value, out _Song.Gap))
|
||||
_Song.Gap /= 1000f;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid gap: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid gap: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "COVER":
|
||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||
_Song.CoverFileName = value;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Can't find cover file: {MissingFile}", _Song.FileName, Path.Combine(_Song.Folder, value));
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Can't find cover file: {MissingFile}", CLog.Params(_Song.FileName, Path.Combine(_Song.Folder, value)));
|
||||
break;
|
||||
case "BACKGROUND":
|
||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||
_Song.BackgroundFileNames.Add(value);
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Can't find background file: {MissingFile}", _Song.FileName, Path.Combine(_Song.Folder, value));
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Can't find background file: {MissingFile}", CLog.Params(_Song.FileName, Path.Combine(_Song.Folder, value)));
|
||||
break;
|
||||
case "VIDEO":
|
||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||
_Song.VideoFileName = value;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Can't find video file: {MissingFile}", _Song.FileName, Path.Combine(_Song.Folder, value));
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Can't find video file: {MissingFile}", CLog.Params(_Song.FileName, Path.Combine(_Song.Folder, value)));
|
||||
break;
|
||||
case "VIDEOGAP":
|
||||
if (!CHelper.TryParse(value, out _Song.VideoGap))
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid videogap: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid videogap: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "VIDEOASPECT":
|
||||
if (!CHelper.TryParse(value, out _Song.VideoAspect, true))
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid videoaspect: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid videoaspect: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "START":
|
||||
if (!CHelper.TryParse(value, out _Song.Start))
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid start: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid start: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "END":
|
||||
if (CHelper.TryParse(value, out _Song.Finish))
|
||||
_Song.Finish /= 1000f;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid end: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid end: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "PREVIEWSTART":
|
||||
if (CHelper.TryParse(value, out _Song.Preview.StartTime) && _Song.Preview.StartTime >= 0f)
|
||||
_Song.Preview.Source = EDataSource.Tag;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid previewstart: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid previewstart: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "PREVIEW":
|
||||
if (CHelper.TryParse(value, out _Song.Preview.StartTime) && _Song.Preview.StartTime >= 0f)
|
||||
@@ -283,19 +283,19 @@ namespace VocaluxeLib.Songs
|
||||
_Song.Preview.Source = EDataSource.Tag;
|
||||
}
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid previewstart: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid previewstart: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "MEDLEYSTARTBEAT":
|
||||
if (int.TryParse(value, out _Song.Medley.StartBeat))
|
||||
headerFlags |= EHeaderFlags.MedleyStartBeat;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid medleystartbeat: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid medleystartbeat: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "MEDLEYENDBEAT":
|
||||
if (int.TryParse(value, out _Song.Medley.EndBeat))
|
||||
headerFlags |= EHeaderFlags.MedleyEndBeat;
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid medleyendbeat: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid medleyendbeat: {Value}", CLog.Params(_Song.FileName, value));
|
||||
break;
|
||||
case "ENDSHORT":
|
||||
if ((headerFlags & EHeaderFlags.BPM) != 0)
|
||||
@@ -307,7 +307,7 @@ namespace VocaluxeLib.Songs
|
||||
_Song.ShortEnd.Source = EDataSource.Tag;
|
||||
}
|
||||
else
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Invalid shortendbeat: {Value}", _Song.FileName, value);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid shortendbeat: {Value}", CLog.Params(_Song.FileName, value));
|
||||
}
|
||||
break;
|
||||
case "CALCMEDLEY":
|
||||
@@ -342,7 +342,7 @@ namespace VocaluxeLib.Songs
|
||||
else
|
||||
{
|
||||
_Song.UnknownTags.Add(line);
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Unknown tag: #{Identifier}", _Song.FileName, identifier);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Unknown tag: #{Identifier}", CLog.Params(_Song.FileName, identifier));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -352,32 +352,32 @@ namespace VocaluxeLib.Songs
|
||||
if (sr.EndOfStream)
|
||||
{
|
||||
//No other data then header
|
||||
CBase.Log.LogSongError("[{SongFileName}] Lyrics/Notes missing", _Song.FileName);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Lyrics/Notes missing", CLog.Params(_Song.FileName));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((headerFlags & EHeaderFlags.Title) == 0)
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] Title tag missing", _Song.FileName);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Title tag missing", CLog.Params(_Song.FileName));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((headerFlags & EHeaderFlags.Artist) == 0)
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] Artist tag missing", _Song.FileName);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Artist tag missing", CLog.Params(_Song.FileName));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((headerFlags & EHeaderFlags.MP3) == 0)
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] MP3 tag missing", _Song.FileName);
|
||||
CLog.CSongLog.Error("[{SongFileName}] MP3 tag missing", CLog.Params(_Song.FileName));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((headerFlags & EHeaderFlags.BPM) == 0)
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] BPM tag missing", _Song.FileName);
|
||||
CLog.CSongLog.Error("[{SongFileName}] BPM tag missing", CLog.Params(_Song.FileName));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
if (_Song.Medley.StartBeat > _Song.Medley.EndBeat)
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] MedleyStartBeat is bigger than MedleyEndBeat in file: {StartBeat} > {EndBeat}", _Song.FileName, _Song.Medley.StartBeat > _Song.Medley.EndBeat);
|
||||
CLog.CSongLog.Error("[{SongFileName}] MedleyStartBeat is bigger than MedleyEndBeat in file: {StartBeat} > {EndBeat}", CLog.Params(_Song.FileName, _Song.Medley.StartBeat > _Song.Medley.EndBeat));
|
||||
headerFlags = headerFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat;
|
||||
}
|
||||
}
|
||||
@@ -412,7 +412,7 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
if (sr != null)
|
||||
sr.Dispose();
|
||||
CBase.Log.LogSongError(e, "[{SongFileName}] Error reading txt header with Message: {ExceptionMessage}", e.Message, _Song.FileName);
|
||||
CLog.CSongLog.Error(e, "[{SongFileName}] Error reading txt header with Message: {ExceptionMessage}", CLog.Params(e.Message, _Song.FileName));
|
||||
return false;
|
||||
}
|
||||
_Song.Encoding = sr.CurrentEncoding;
|
||||
@@ -509,7 +509,7 @@ namespace VocaluxeLib.Songs
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] The file songfile does not exist", _Song.FileName);
|
||||
CLog.CSongLog.Error("[{SongFileName}] The file songfile does not exist", CLog.Params(_Song.FileName));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace VocaluxeLib.Songs
|
||||
|
||||
if (!int.TryParse(line, out player))
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] Wrong or missing number after \"P\" (in line {LineNr})", _Song.FileName, _LineNr);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Wrong or missing number after \"P\" (in line {LineNr})", CLog.Params(_Song.FileName, _LineNr));
|
||||
return false;
|
||||
}
|
||||
currentBeat = 0;
|
||||
@@ -572,25 +572,25 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
if (noteData.Length == 3)
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Ignored note without text (in line {LineNr})", _Song.FileName, _LineNr);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Ignored note without text (in line {LineNr})", CLog.Params(_Song.FileName, _LineNr));
|
||||
changesMade.NoTextNoteCt++;
|
||||
continue;
|
||||
}
|
||||
CBase.Log.LogSongError("[{SongFileName}] Invalid note found (in line {LineNr}): {noteData}", _Song.FileName, _LineNr, noteData);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Invalid note found (in line {LineNr}): {noteData}", CLog.Params(_Song.FileName, _LineNr, noteData));
|
||||
sr.Dispose();
|
||||
return false;
|
||||
}
|
||||
int tone;
|
||||
if (!int.TryParse(noteData[0], out beat) || !int.TryParse(noteData[1], out length) || !int.TryParse(noteData[2], out tone))
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] Invalid note found (non-numeric values) (in line {LineNr}): {noteData}", _Song.FileName, _LineNr, noteData);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Invalid note found (non-numeric values) (in line {LineNr}): {noteData}", CLog.Params(_Song.FileName, _LineNr, noteData));
|
||||
sr.Dispose();
|
||||
return false;
|
||||
}
|
||||
string text = noteData[3].TrimMultipleWs();
|
||||
if (text == "")
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Ignored note without text (in line {LineNr})", _Song.FileName, _LineNr);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Ignored note without text (in line {LineNr})", CLog.Params(_Song.FileName, _LineNr));
|
||||
changesMade.NoTextNoteCt++;
|
||||
continue;
|
||||
}
|
||||
@@ -601,12 +601,12 @@ namespace VocaluxeLib.Songs
|
||||
changesMade.ZeroLengthNoteCt++;
|
||||
if (_CurrentReadMode == ENoteReadMode.Normal && changesMade.ZeroLengthNoteCt > _MaxZeroNoteCt && changesMade.OverlapNoteCt <= _MaxOverlapNoteCt)
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Found more than {MaxZeroNoteCt} notes with length < 1. Trying alternative read mode.", _Song.FileName, _MaxZeroNoteCt);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Found more than {MaxZeroNoteCt} notes with length < 1. Trying alternative read mode.", CLog.Params(_Song.FileName, _MaxZeroNoteCt));
|
||||
_CurrentReadMode = ENoteReadMode.ZeroBased;
|
||||
sr.Dispose();
|
||||
return ReadNotes(true);
|
||||
}
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Ignored note with length < 1 (in line {LineNr})", _Song.FileName, _LineNr);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Ignored note with length < 1 (in line {LineNr})", CLog.Params(_Song.FileName, _LineNr));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -635,13 +635,13 @@ namespace VocaluxeLib.Songs
|
||||
changesMade.OverlapNoteCt++;
|
||||
if (changesMade.OverlapNoteCt > _MaxOverlapNoteCt && _CurrentReadMode == ENoteReadMode.ZeroBased)
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Found more than {MaxOverlapNoteCt} overlapping notes. Using standard mode.", _Song.FileName, _MaxOverlapNoteCt);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Found more than {MaxOverlapNoteCt} overlapping notes. Using standard mode.", CLog.Params(_Song.FileName, _MaxOverlapNoteCt));
|
||||
_CurrentReadMode = ENoteReadMode.OneBased;
|
||||
sr.Dispose();
|
||||
return ReadNotes(true);
|
||||
}
|
||||
}
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Ignored note for player {CurrentPlayerNumber} because it overlaps with other note (in line {LineNr})", _Song.FileName, (curPlayer + 1), _LineNr);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Ignored note for player {CurrentPlayerNumber} because it overlaps with other note (in line {LineNr})", CLog.Params(_Song.FileName, (curPlayer + 1), _LineNr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -650,13 +650,13 @@ namespace VocaluxeLib.Songs
|
||||
string[] lineBreakData = line.Split(splitChars);
|
||||
if (lineBreakData.Length < 1)
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] Invalid line break found (No beat) (in line {LineNr}): {LineBreakData}", _Song.FileName, _LineNr, lineBreakData);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Invalid line break found (No beat) (in line {LineNr}): {LineBreakData}", CLog.Params(_Song.FileName, _LineNr, lineBreakData));
|
||||
sr.Dispose();
|
||||
return false;
|
||||
}
|
||||
if (!int.TryParse(lineBreakData[0], out beat))
|
||||
{
|
||||
CBase.Log.LogSongError("[{SongFileName}] Invalid line break found (Non-numeric value) (in line {LineNr}): {LineBreakData}", _Song.FileName, _LineNr, lineBreakData);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Invalid line break found (Non-numeric value) (in line {LineNr}): {LineBreakData}", CLog.Params(_Song.FileName, _LineNr, lineBreakData));
|
||||
sr.Dispose();
|
||||
return false;
|
||||
}
|
||||
@@ -666,7 +666,7 @@ namespace VocaluxeLib.Songs
|
||||
beat += currentBeat;
|
||||
if (lineBreakData.Length < 2 || !int.TryParse(lineBreakData[1], out length))
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Missing line break length (in line {LineNr}):{LineBreakData}", _Song.FileName, _LineNr, lineBreakData);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Missing line break length (in line {LineNr}):{LineBreakData}", CLog.Params(_Song.FileName, _LineNr, lineBreakData));
|
||||
changesMade.NoLengthBreakCt++;
|
||||
currentBeat = beat;
|
||||
}
|
||||
@@ -676,7 +676,7 @@ namespace VocaluxeLib.Songs
|
||||
|
||||
if (lastNote != null && beat <= lastNote.EndBeat)
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Line break is before previous note end. Adjusted. (in line {LineNr})", _Song.FileName, _LineNr);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Line break is before previous note end. Adjusted. (in line {LineNr})", CLog.Params(_Song.FileName, _LineNr));
|
||||
|
||||
changesMade.AjustedBreakCt++;
|
||||
if (_Song.Relative)
|
||||
@@ -686,7 +686,7 @@ namespace VocaluxeLib.Songs
|
||||
|
||||
if (beat < 1)
|
||||
{
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Ignored line break because position is < 1 (in line {LineNr})", _Song.FileName, _LineNr);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Ignored line break because position is < 1 (in line {LineNr})", CLog.Params(_Song.FileName, _LineNr));
|
||||
changesMade.InvalidPosBreakCt++;
|
||||
}
|
||||
else
|
||||
@@ -694,12 +694,12 @@ namespace VocaluxeLib.Songs
|
||||
foreach (int curPlayer in player.GetSetBits())
|
||||
{
|
||||
if (!_NewSentence(curPlayer, beat))
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Ignored line break for player {CurPlayerNr} (Overlapping or duplicate) (in line {LineNr})", _Song.FileName, (curPlayer + 1) , _LineNr);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Ignored line break for player {CurPlayerNr} (Overlapping or duplicate) (in line {LineNr})", CLog.Params(_Song.FileName, (curPlayer + 1) , _LineNr));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CBase.Log.LogSongError("[{SongFileName}] Unexpected or missing character ({Tag})", _Song.FileName, tag);
|
||||
CLog.CSongLog.Error("[{SongFileName}] Unexpected or missing character ({Tag})", CLog.Params(_Song.FileName, tag));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -709,13 +709,13 @@ namespace VocaluxeLib.Songs
|
||||
CVoice voice = _Song.Notes.GetVoice(i);
|
||||
int emptyLines = voice.RemoveEmptyLines();
|
||||
if (emptyLines > 0)
|
||||
CBase.Log.LogSongWarning("[{SongFileName}] Removed {NumEmptyLines} empty lines from P .This often indicates a problem with the line breaks in the file", _Song.FileName, emptyLines);
|
||||
CLog.CSongLog.Warning("[{SongFileName}] Removed {NumEmptyLines} empty lines from P .This often indicates a problem with the line breaks in the file", CLog.Params(_Song.FileName, emptyLines));
|
||||
voice.UpdateTimings();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogSongError(e, "[{SongFileName}] An unhandled exception occured: {ExceptionMessage}", _Song.FileName, e.Message);
|
||||
CLog.CSongLog.Error(e, "[{SongFileName}] An unhandled exception occured: {ExceptionMessage}", CLog.Params(_Song.FileName, e.Message));
|
||||
if (sr != null)
|
||||
sr.Dispose();
|
||||
return false;
|
||||
@@ -732,14 +732,13 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogSongError(e, "[{SongFileName}] An unhandled exception occured: {ExceptionMessage}", _Song.FileName, e.Message);
|
||||
CLog.CSongLog.Error(e, "[{SongFileName}] An unhandled exception occured: {ExceptionMessage}", CLog.Params(_Song.FileName, e.Message));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (changesMade.IsModified)
|
||||
{
|
||||
string msg = "Automatic changes have been made to " + filePath + " Please check result!\r\n" + changesMade;
|
||||
CBase.Log.LogError("Warning: " + msg);
|
||||
CLog.Warning("Automatic changes have been made to {FilePath} Please check result!\r\n{ChangesMade}" , CLog.Params(filePath, changesMade));
|
||||
if (CBase.Config.GetSaveModifiedSongs() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
string name = Path.GetFileNameWithoutExtension(_Song.FileName);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using VocaluxeLib.Log;
|
||||
|
||||
namespace VocaluxeLib.Songs
|
||||
{
|
||||
@@ -207,12 +208,12 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
CBase.Log.LogError("Cannot write " + filePath + ". Directory might be readonly or requires admin rights.");
|
||||
CLog.Error("Cannot write " + filePath + ". Directory might be readonly or requires admin rights.");
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Unhandled exception while writing " + filePath + ": " + e);
|
||||
CLog.Error("Unhandled exception while writing " + filePath + ": " + e);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -82,6 +82,31 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Serilog.2.6.0\lib\net46\Serilog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Serilog.Enrichers.Thread, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Serilog.Enrichers.Thread.3.0.0\lib\net45\Serilog.Enrichers.Thread.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Serilog.Sinks.Console, Version=3.1.1.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Serilog.Sinks.Console.3.1.1\lib\net45\Serilog.Sinks.Console.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Serilog.Sinks.File, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Serilog.Sinks.File.4.0.0\lib\net45\Serilog.Sinks.File.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Serilog.Sinks.TextWriter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Serilog.Sinks.TextWriter.2.1.0\lib\net45\Serilog.Sinks.TextWriter.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SerilogTimings, Version=2.2.0.0, Culture=neutral, PublicKeyToken=ea6fc7d88906f03a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SerilogTimings.2.2.0\lib\net45\SerilogTimings.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
@@ -91,10 +116,19 @@
|
||||
<Compile Include="CEncoding.cs" />
|
||||
<Compile Include="CFading.cs" />
|
||||
<Compile Include="CFont.cs" />
|
||||
<Compile Include="Log\CLog.cs" />
|
||||
<Compile Include="CVideoStream.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="IBasic.cs" />
|
||||
<Compile Include="Log\Enricher\CTimeStampFromStartEnricher.cs" />
|
||||
<Compile Include="Log\Rolling\LogRoller.cs" />
|
||||
<Compile Include="Log\Serilog\SilentLogger.cs" />
|
||||
<Compile Include="Log\CLogFunctions.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>CLogFunctions.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Menu\CBackground.cs" />
|
||||
<Compile Include="CBasic.cs" />
|
||||
<Compile Include="Menu\CButton.cs" />
|
||||
@@ -160,6 +194,18 @@
|
||||
<Compile Include="Utils\Player\CSoundPlayer.cs" />
|
||||
<Compile Include="Xml\SFieldInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Log\CLogFunctions.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>CLogFunctions.cs</LastGenOutput>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using VocaluxeLib.Log;
|
||||
|
||||
namespace VocaluxeLib.Xml
|
||||
{
|
||||
@@ -173,7 +174,7 @@ namespace VocaluxeLib.Xml
|
||||
{
|
||||
if (e.IsError)
|
||||
throw e;
|
||||
CBase.Log.LogError(e.ToString());
|
||||
CLog.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Serilog" version="2.6.0" targetFramework="net471" />
|
||||
<package id="Serilog.Enrichers.Thread" version="3.0.0" targetFramework="net471" />
|
||||
<package id="Serilog.Sinks.Console" version="3.1.1" targetFramework="net471" />
|
||||
<package id="Serilog.Sinks.File" version="4.0.0" targetFramework="net471" />
|
||||
<package id="Serilog.Sinks.TextWriter" version="2.1.0" targetFramework="net471" />
|
||||
<package id="SerilogTimings" version="2.2.0" targetFramework="net471" />
|
||||
</packages>
|
||||
Reference in new issue
Block a user