Skip to content

Instantly share code, notes, and snippets.

@fitomad

fitomad/adapter_logic.swift Secret

Created Apr 8, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.