Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
109 additions
and
8 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
src/Quartz.Tests.Integration/FailFastLoggerFactoryAdapter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
using Common.Logging; | ||
using Common.Logging.Factory; | ||
|
||
namespace Quartz.Tests.Integration | ||
{ | ||
internal class FailFastLoggerFactoryAdapter : ILoggerFactoryAdapter | ||
{ | ||
private static readonly List<string> errors = new List<string>(); | ||
|
||
public ILog GetLogger(Type type) | ||
{ | ||
return new FailFastLogger(this); | ||
} | ||
|
||
public ILog GetLogger(string name) | ||
{ | ||
return new FailFastLogger(this); | ||
} | ||
|
||
private void ReportError(string error) | ||
{ | ||
errors.Add(error); | ||
} | ||
|
||
public static List<string> Errors | ||
{ | ||
get { return errors; } | ||
} | ||
|
||
private class FailFastLogger : AbstractLogger | ||
{ | ||
private readonly FailFastLoggerFactoryAdapter parent; | ||
|
||
public FailFastLogger(FailFastLoggerFactoryAdapter parent) | ||
{ | ||
this.parent = parent; | ||
} | ||
|
||
protected override void WriteInternal(LogLevel level, object message, Exception exception) | ||
{ | ||
parent.ReportError("" + message); | ||
} | ||
|
||
public override bool IsTraceEnabled | ||
{ | ||
get { return false; } | ||
} | ||
|
||
public override bool IsDebugEnabled | ||
{ | ||
get { return false; } | ||
} | ||
|
||
public override bool IsErrorEnabled | ||
{ | ||
get { return true; } | ||
} | ||
|
||
public override bool IsFatalEnabled | ||
{ | ||
get { return true; } | ||
} | ||
|
||
public override bool IsInfoEnabled | ||
{ | ||
get { return false; } | ||
} | ||
|
||
public override bool IsWarnEnabled | ||
{ | ||
get { return true; } | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters