[swift-evolution] Logging facade

Mike Kluev mike.kluev at gmail.com
Thu Nov 2 13:24:54 CDT 2017


on Date: Wed, 01 Nov 2017 10:58:38 -0700 Max Moiseev <moiseev at apple.com>
wrote:

>
> I believe you are looking for the «one true way of doing logging» that is
> community accepted, but it does not have to be in the standard library to
> be that. A standalone package would do just as well. swift-server-dev
> mailing list might be a better place to discuss this idea.
>

this is only tangentially relevant to what op is asking for - i remember
having to do something like this to trace every function enter / exit into
a log:

func foo() {
    enter() { defer exit() }
    ...
    ...
}

and copy-paste that mantra at the beginning of every function. the enter /
exit would do some printing of the method name (#function) among other
things.

it was a bit annoying manually doing so in every method, and one of course
can dream of some automated built-in facility to the same effect. until
that time, manual tricks like this will do.

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171102/7b6756f6/attachment.html>


More information about the swift-evolution mailing list