[swift-evolution] Proposal: standard logging facility
David Waite
david at alkaline-solutions.com
Sat Dec 5 15:05:14 CST 2015
I would propose the simplest interface that I can assume is available *everywhere* to be defined by the Swift standard library, so as a framework developer I can make assumptions on my ability to provide diagnostics for internals, expose information for statistical use, provide information needed for auditing usage if I’m working on a hosted service and not a GUI app, and so on.
Things like custom formatters and appenders providing integration into remote/system services are something that the application can decide when it chooses a logging framework that implements the standard-defined protocol.
There isn’t any sort of dependency injection/inversion of control at the core swift level, which usually means that either logging is done by global functions, or by a global factory returns an instance of some type implementing the logging protocol.
The only piece of this which jumps out as not pure swift would be default integration into something like syslog or NSLog, and possibly adding a new preprocessor “macro” like __MODULE__
-DW
> On Dec 5, 2015, at 1:20 PM, Kevin Barrett via swift-evolution <swift-evolution at swift.org> wrote:
>
> +1 to this.
>
> On Sat, Dec 5, 2015 at 2:24 PM, Alexander Kolov via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> Hi everyone,
>
> Coming from a short discussion in swift-corelibs-dev, I’m investigating the need of a standard logging API as a part of core libraries.
>
> The motivation behind this would be having a unified and configurable set of APIs between all first-party modules and third party applications and libraries.
> I think this will help each of us since right now we’re inventing our own solutions as well many bigger third-party library providers have formats and facilities of their own.
>
> As I currently see it would be somewhat similar to python logging and possibly even structlog (http://www.structlog.org/en/stable/ <http://www.structlog.org/en/stable/>), with configurable formatters and handlers, including and not limited to remote loggers and syslog support.
>
> I’d love to hear your opinions and feedback on this and possibly start with some more formalized proposal and implementation if there’s enough support and need.
>
> Thanks,
> Alex
>
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151205/51e34079/attachment.html>
More information about the swift-evolution
mailing list