The design

We are going to separate the design into two sections. The first section will be the logger profile section that will contain the types that will do the actual logging of the messages to a storage medium, or display them. The second section will be the logger section that will contain the types that the applications interface with. The logger types will determine the log level of the message and then pass the message to the appropriate logger profiles to log the message. Let's start off by looking at the logger profile section.

We will begin the logger profile design by creating a protocol named LoggerProfile. This protocol will define the interface that the logger profiles will present, and any type that conforms to this protocol ...

Get Swift 4 Protocol-Oriented Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.