snipsco / Postal

A Swift framework for working with emails
MIT License
652 stars 81 forks source link

postal.logger statement doesn't compile #51

Closed ikemuc closed 7 years ago

ikemuc commented 7 years ago

Hi klevefre,

you wrote about debugging Postal:

You can set a closure on a Postal instance to have IMAP logs: let postal = Postal(configuration: ...) postal.logger { log in print(log) }

Unfortunately this doesn't work in my code. I get the compiler error message "Cannot call value of non-function type 'logger?'

This is my code:

init(hostname: String, userName: String, password: String) {
    log.debug("init called...")

    configuration = Configuration(hostname: hostname, port: 993, login: userName, password: .plain(password), connectionType: .tls, checkCertificateEnabled: false)

    let postal: Postal = Postal(configuration: configuration)
    postal.logger { log in
        print(log)
    }
[...]

What's wrong with my code? It's exactly as you wrote...?

klefevre commented 7 years ago

I'm sorry i've made a typo it's:

let postal = Postal(configuration: ...)
postal.logger = { log in
    print(log)
}