#@ 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
///
/// Write an event with the <#= LogLevel #> level to the <#= LogLevel #> log.
///
/// Message template for this event.
<# if(Log == "Main") { #>
/// True if an message should be shown to the user, false otherwise.
<# } #>
/// Don't use! The methode name of the caller will be filled automatically by the compiler.
/// Don't use! The filepath of the caller will be filled automatically by the compiler.
/// Don't use! The line number of the caller will be filled automatically by the compiler.
[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);
<# } #>
}
///
/// Write an event with the <#= LogLevel #> level with additional propertyValues to the <#= LogLevel #> log.
///
/// Message template for this event.
/// Data inserted into the message template.
<# if(Log == "Main") { #>
/// True if an message should be shown to the user, false otherwise.
<# } #>
/// Don't use! The methode name of the caller will be filled automatically by the compiler.
/// Don't use! The filepath of the caller will be filled automatically by the compiler.
/// Don't use! The line number of the caller will be filled automatically by the compiler.
[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);
<# } #>
}
///
/// Write an event with the <#= LogLevel #> level and associated exception to the <#= LogLevel #> log.
///
/// Exception of this event.
/// Message template for this event.
<# if(Log == "Main") { #>
/// True if an message should be shown to the user, false otherwise.
<# } #>
/// Don't use! The methode name of the caller will be filled automatically by the compiler.
/// Don't use! The filepath of the caller will be filled automatically by the compiler.
/// Don't use! The line number of the caller will be filled automatically by the compiler.
[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);
<# } #>
}
///
/// Write an event with the <#= LogLevel #> level with additional propertyValues and associated exception to the <#= LogLevel #> log.
///
/// Exception of this event.
/// Message template for this event.
/// Data inserted into the message template.
<# if(Log == "Main") { #>
/// True if an message should be shown to the user, false otherwise.
<# } #>
/// Don't use! The methode name of the caller will be filled automatically by the compiler.
/// Don't use! The filepath of the caller will be filled automatically by the compiler.
/// Don't use! The line number of the caller will be filled automatically by the compiler.
[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(); #>
}
<# } #>
<# } #>
}
}