Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

49 lines
823 B
C#

using System;
namespace Mono
{
public class Logger
{
public enum Level
{
Debug = 1,
Warning = 2,
Error = 3,
None = 4,
}
Level level;
Action<string> logAction;
public Logger (Level level, Action<string> logAction)
{
this.level = level;
this.logAction = logAction;
}
public void LogDebug (string str, params string[] vals)
{
Log (Level.Debug, "Debug: " + str, vals);
}
public void LogWarning (string str, params string[] vals)
{
Log (Level.Warning, "Warning: " + str, vals);
}
public void LogError (string str, params string[] vals)
{
Log (Level.Error, "Error: " + str, vals);
}
private void Log (Level msgLevel, string str, params string[] vals)
{
if ((int) level > (int) msgLevel)
return;
logAction (string.Format (str, vals));
}
}
}