File tree 2 files changed +29
-0
lines changed
src/epilogue/Logging/Errors
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ namespace Epilogue . Logging . Errors ;
2
+
3
+ public interface IErrorHandler {
4
+ void Handle ( Exception exception , ClassSpecificLogger logger ) ;
5
+
6
+ public static IErrorHandler CrashOnError ( ) => new CrashOnError ( ) ;
7
+
8
+ public static IErrorHandler PrintErrorMessages ( ) => new ErrorPrint ( ) ;
9
+
10
+ public static LoggerDisabler Disabling ( int maximumPermissableErrors ) => LoggerDisabler . ForLimit ( maximumPermissableErrors ) ;
11
+ }
Original file line number Diff line number Diff line change
1
+
2
+ namespace Epilogue . Logging . Errors ;
3
+
4
+ public class LoggerDisabler : IErrorHandler {
5
+ private readonly int m_threshold ;
6
+ private readonly Dictionary < ClassSpecificLogger , int > m_errorCounts = [ ] ;
7
+
8
+ public LoggerDisabler ( int threshold ) {
9
+ m_threshold = threshold ;
10
+ }
11
+
12
+ public static LoggerDisabler ForLimit ( int threshold ) => new LoggerDisabler ( threshold ) ;
13
+
14
+ public void Handle ( Exception exception , ClassSpecificLogger logger )
15
+ {
16
+ throw new NotImplementedException ( ) ;
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments