Skip to content

Instantly share code, notes, and snippets.

@cmvandrevala
Last active March 11, 2017 22:23
Show Gist options
  • Save cmvandrevala/54ba49cc612cb3b36c473951247461e7 to your computer and use it in GitHub Desktop.
Save cmvandrevala/54ba49cc612cb3b36c473951247461e7 to your computer and use it in GitHub Desktop.
Add a logger class to the simple print statements
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