Migrating to Unified Logging, Swift Edition
I have a new blog post up on our company blog. If you have a Swift project that is not yet using Unified Logging (os_log
and friends), I think you’ll find this helpful. There are some surprising differences, for better and for worse, compared to NSLog
and print
statements.
If you’re brave, I also have an open-source Swift wrapper around the Unified Logging APIs which takes some of the edge off of the migration away from legacy logging techniques.
Twitter Made Flesh
OH:
I unfollowed my wife. She came home one day, keys jangling against the dusk. Check this out, I said, making a witty joke about a reference, a joke I had made earlier that was laughed at by the right people. She dumped her bags on the chair by the door. I repeated the joke. She went on through the house, past me, past the joke she didn’t get, racing for her cozy clothes by the bed. It was a funny joke. It had a reference in it. She walked past the joke, past me. The right people had laughed at it. She put on her cozy clothes. I unfollowed her. She asked me later to explain the joke, but I had unfollowed her, so there was nothing else I could do.
I unfollowed my dad. He said something about “the Lord”. I don’t like what he believes. He doesn’t know about what I believe. It was family dinner out, at the restaurant where they had a shooting a week later when two men with guns shot and killed a third man who shot at the guests with a gun, and my Dad said something about “the Lord”, and that was one too many things about “the Lord” for me to hear that day. So I unfollowed my Dad. Now I don’t hear about “the Lord” anymore.
I unfollowed the other parents at my kid’s school. It didn’t take long.
I didn’t stop there.
I unfollowed the one who wears those Oakley sunglasses. I unfollowed the one with flaky ears. I unfollowed everyone with a Samsung phone. I unfollowed the one parked outside the Dave & Busters probably waiting to go inside. I was driving fast, I couldn’t be sure. Better to be cautious. I unfollowed the one who chose a heartbreaking brand of beer.
I unfollowed everyone who doesn’t appreciate how much effort I have put into my guilt.
Bad Idea Rejection Tokens™
Something I really appreciate1 when I see it manifested in an engineering lead is the habit of letting subordinates’ arguments frequently win the day during run-of-the-mill code reviews, even when the lead remains skeptical or — especially — is in sharp disagreement with the proposed changes. Disagreeing but permitting isn’t a sign of weakness. In the context of a healthy team dynamic, it’s a sign of good leadership.
There are a finite number of Bad Idea Rejection Tokens™ that a lead can cash in before their teammates conclude that the team lead has a closed mind and a bad attitude. “I wouldn’t have done it that way” is not something an engineering lead should find themselves saying often during code review. Making a habit of rejecting your teammates’ work is toxic for morale and productivity. If instead the lead only occasionally exercises their veto powers, then the teammates can trust that when the lead rejects their work it isn’t motivated by stubbornness but by a good-faith effort to practice good judgment. Finding the right balance between permissiveness and restraint is key.
-
Yep, it’s a good habit I’m seeing demonstrated at work these days, and I’m stoked about it. ↩︎
Welcome Home (Pod), a Very Short Play About Apple’s Inexcusable Failure to Recognize Even Mildly Disfluent Speech
JARED
Hey Siri, play, uhh—
HOMEPOD
(Siri light turns on)
IPHONE, IPAD, APPLE WATCH
(Siri reacting on all of them)
Beep-beep!
JARED
(still thinking, all those devices reacting doesn’t help)
—umm…
HOMEPOD
(resumes playback of the previous song from an hour earlier)
IPHONE, IPAD, APPLE WATCH
(go dark again)
JARED
No! Stop!
HOMEPOD
(continues playing)
JARED
Stop playi—
(irritated, but finally remembering to use the key phrase)
Hey Siri—
IPHONE, IPAD, APPLE WATCH
Beep-beep!
JARED
—stop playing.
HOMEPOD
(stops)
The front door opens as HENRY, four-and-a-half years old, comes in the door after a weekend at his grandmother’s.
HENRY
Hi Daddy!
(notices the Home Pod)
What’s that?
JARED
It’s a Home Pod.
HENRY
Hōmpa?
JARED
(enunciating exaggeratedly)
Hō-muh Pô-duh.
HENRY
Home Pod? What’s it do?
JARED
It has Siri on it, it plays music.
Henry is excited. He’s thinking of a song in his dad’s “Henry” playlist called “Drift feat. RZA” that he’s been listening to at least twice a day for the past few weeks. He leans his face towards the top of the Home Pod.
HENRY
Play Drift!
The Home Pod does not respond.
JARED
No, you have to say “Hey Siri”
IPHONE, IPAD, APPLE WATCH
Beep-beep!
HOME POD
(lights up)
HENRY
Hey Siri! Play Drift!
HOME POD
Okay, playing Drift by Joshua Lee.
(wrong song starts playing)
HENRY
No! Siri, play Drift from Pacific Rim!
HOME POD
(unresponsive, continues playing wrong song)
JARED
No, you have to say
(quietly this time)
“Hey Siri”
HOME POD
(lights up, ducking the audio)
HENRY
Siri!
(with some disfluency typical of his age)
Play Pacifi— play Drift from Pacific Rim.
HOME POD
OK, here’s some Dr. Dre just for you.
(Dr. Dre starts)
HENRY
Hey Siri! Play the Drift song from Pacific Rim.
HOME POD
I couldn’t find “Fred’s F****g Pussy” in your library or on Apple Music.
(Dr. Dre resumes)
HENRY
Siri! Play the Drift song from Pacific— from Pacific Rim.
HOME POD
(Dr. Dre continues, unabated)
JARED
(loudly, over the music)
You’ve gotta say “Hey Siri”
IPHONE, IPAD, APPLE WATCH
Beep-beep!
HOME POD
(lights up, ducking the audio)
HENRY
Siri! Play Drift from Pacific Rim
HOME POD
I couldn’t find Drake Pacific Rim in your library or on Apple Music.
(Dr. Dre continues)
JARED
Hey Siri, stop playing.
HOME POD
(stops)
HENRY
Hey Siri, play Drift from Pacific Rim
HOME POD
I couldn’t find Drift From Pacific Rim in your library or on Apple Music.
JARED
(enunciating exaggeratedly)
Hey Siri, play the song Drift from the Pacific Rim soundtrack.
HOME POD
OK, now playing “Drift featuring RZA” by Blake Perlman and RZA.
(Correct song starts)
Keep Screen Unlocked: ’sodes Feature for Folks Who Don’t Have CarPlay
Keep Screen Unlocked is a handy (optional) feature in ’sodes that keeps play controls accessible at all times. It isn’t a technical marvel by any stretch, but it comes in handy if you:
- Go on long trips or commutes
- Don’t have or can’t use Bluetooth in your car (or don’t have easily-reached Bluetooth controls)
- Don’t have CarPlay, either
- Put your phone in a dashboard mount
- Use a car charger for your phone
It’s not a universal use case, but it’s one that I’ve been in. Once you’ve enabled the feature in Settings.app, all that’s required to trigger the feature is for these three conditions to be met:
- ’sodes is running in the foreground
- ’sodes is playing (not paused)
- Your phone is connected to a charger
Why? Because this keeps ’sodes play controls accessible in a hurry. Without this, your phone’s display will eventually go dark and your screen will lock, requiring you to manipulate your phone before you can tap a pause button, if you can even tap it in iOS’ tiny Now Playing lock screen widget. That latter irrituation is why ’sodes play/pause button is so generously-sized. You can tap it easily even with your arm extended as your car bounces down the highway.
This setting is off by default. And even if you enable it, it will not engage unless all three conditions are met. Otherwise your normal locking behavior will take over.
If you (or someone you like a whole lot) would enjoy a more relaxing way to get into podcasts, please check out ’sodes. It launches February 15th, but is available for pre-order now.