private static Action<string> MtLogger = Console.WriteLine;
private static Action<string> Serilog = Console.WriteLine;
public static void Main()
var c = new ServiceClass();
c.DoAThing(1, "two", LogAThingInScheduler);
var c2 = new ServiceClass();
c2.DoAThing(1, "two", LogAThingInMedTrack);
public static void LogAThingInMedTrack(int logLevel, string logMessage)
const string logName = nameof(MtLogger);
MtLogger(logName + ": INFO -- " + logMessage);
MtLogger(logName + ": ERROR -- " + logMessage);
MtLogger(logName + ": DEBUG -- " + logMessage);
public static void LogAThingInScheduler(int logLevel, string logMessage)
const string logName = nameof(Serilog);
Serilog(logName + ": INFO -- " + logMessage);
Serilog(logName + ": ERROR -- " + logMessage);
Serilog(logName + ": DEBUG -- " + logMessage);
public class ServiceClass
public void DoAThing(int param1, string param2, Action<int, string> logWithLevel)
logWithLevel(1, "This is a info Message from the service");
logWithLevel(2, "This is a error Message from the service");
logWithLevel(3, "This is a debug Message from the service");