-
-
Save fitomad/60138870547a2219cd15eb48dd068a7c to your computer and use it in GitHub Desktop.
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
public class MyBusinessLogic | |
{ | |
/// Sistemas de logs | |
private var loggers: [Logging] | |
/** | |
Vamos a escribir logs en el servidor web | |
y en la base de datos local. | |
*/ | |
public init() | |
{ | |
self.loggers = [ | |
WebLogger() as Logging, | |
CoreDataLogger() as Logging | |
] | |
} | |
/** | |
Una operación cualquiera... | |
*/ | |
public func businessOperation() -> Void | |
{ | |
self.loggers.forEach({ $0.log("Empezando la operación") }) | |
//... | |
self.loggers.forEach({ $0.log("Operación terminada") }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment