Logging in Swift

NSLog or Print

Steven Curtis
6 min readFeb 24, 2020

There are multiple ways to log in Swift. This article will explore them!

Photo by Mildly Useful on Unsplash

Difficulty: Beginner | Easy | Normal | Challenging

Prerequisites:

  • None, although to follow the code you might like to use Playgrounds. Guide: HERE and String interpolation is used later in the article (guide: HERE)

Terminology

Console: A simple window for programming that can display output and (usually) process input

Debugger: A computer program used to test and debug other programs

Function: A group of statements that together can perform a function

IDE: An application that provides a set of features that are used by software developers to create computer software

NSLog: Logging using an error message to the Apple System Log facility

OSLog: Logging, in a way that can log with categories

print: Write items to the standard output

String: A collection of Characters

Logging: A way to capture log messages to memory and disk

Trace: A use of logging to record information of the program’s execution

Why Logging is important

--

--