-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error logger/provider. Default impl prints, as before. Custom can…
… for eg log to sentry.
- Loading branch information
Jasper Blues
committed
Sep 29, 2021
1 parent
544f712
commit 203bf64
Showing
4 changed files
with
96 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// SYMBIOSE | ||
// Copyright 2020 Symbiose Inc | ||
// All Rights Reserved. | ||
// | ||
// NOTICE: This software is proprietary information. | ||
// Unauthorized use is prohibited. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
import Foundation | ||
|
||
public protocol ErrorLoggerProvider { | ||
|
||
func provide(error: Error?) -> ErrorLogger | ||
|
||
} | ||
|
||
public class ConsoleLogProvider: ErrorLoggerProvider { | ||
|
||
public func provide(error: Error?) -> ErrorLogger { | ||
ConsoleErrorLogger() | ||
} | ||
|
||
} | ||
|
||
public protocol ErrorLogger { | ||
|
||
func log(_ message: String) | ||
|
||
func flush() | ||
|
||
} | ||
|
||
class ConsoleErrorLogger: ErrorLogger { | ||
|
||
func log(_ message: String) { | ||
print(message) | ||
} | ||
|
||
func flush() {} // Not required for console logger | ||
|
||
} |
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