Last active
March 11, 2017 22:23
-
-
Save cmvandrevala/54ba49cc612cb3b36c473951247461e7 to your computer and use it in GitHub Desktop.
Add a logger class to the simple print statements
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
class Logger { | |
func logSomeImportantAction() { | |
print("The server has completed some important action.") | |
} | |
func logAnotherImportantAction() { | |
print("The server has completed another important action.") | |
} | |
} | |
class FakeServer { | |
var logger = Logger() | |
func run() { | |
someImportantAction() | |
logger.logSomeImportantAction() | |
anotherImportantAction() | |
logger.logAnotherImportantAction() | |
} | |
private func someImportantAction() -> Void { | |
print("This is some important action!") | |
} | |
private func anotherImportantAction() -> Void { | |
print("This is another important action!") | |
} | |
} | |
var server = FakeServer() | |
server.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment