Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse committed Aug 5, 2024
1 parent 3d12729 commit 680ca40
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/epilogue/Logging/Errors/IErrorHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Epilogue.Logging.Errors;

public interface IErrorHandler {
void Handle(Exception exception, ClassSpecificLogger logger);

public static IErrorHandler CrashOnError() => new CrashOnError();

public static IErrorHandler PrintErrorMessages() => new ErrorPrint();

public static LoggerDisabler Disabling(int maximumPermissableErrors) => LoggerDisabler.ForLimit(maximumPermissableErrors);
}
18 changes: 18 additions & 0 deletions src/epilogue/Logging/Errors/LoggerDisabler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

namespace Epilogue.Logging.Errors;

public class LoggerDisabler : IErrorHandler {
private readonly int m_threshold;
private readonly Dictionary<ClassSpecificLogger, int> m_errorCounts = [];

public LoggerDisabler(int threshold) {
m_threshold = threshold;
}

public static LoggerDisabler ForLimit(int threshold) => new LoggerDisabler(threshold);

public void Handle(Exception exception, ClassSpecificLogger logger)
{
throw new NotImplementedException();
}
}

0 comments on commit 680ca40

Please sign in to comment.