From 62ea1f32d3431b53889a41c8b63c905407ffcb8a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 6 Jun 2026 13:11:41 -0700 Subject: [PATCH] Add a common date formatter for log messages. --- .../Sources/RSCore/DateFormatter+RSCore.swift | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Modules/RSCore/Sources/RSCore/DateFormatter+RSCore.swift diff --git a/Modules/RSCore/Sources/RSCore/DateFormatter+RSCore.swift b/Modules/RSCore/Sources/RSCore/DateFormatter+RSCore.swift new file mode 100644 index 000000000..3c2afb1a5 --- /dev/null +++ b/Modules/RSCore/Sources/RSCore/DateFormatter+RSCore.swift @@ -0,0 +1,19 @@ +// +// DateFormatter+RSCore.swift +// RSCore +// +// Created by Brent Simmons on 6/6/26. +// + +import Foundation + +public extension DateFormatter { + + /// Fixed-format log timestamp: `yyyy-MM-dd HH:mm:ss`, POSIX locale. + static let logTimestamp: DateFormatter = { + let formatter = DateFormatter() + formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + formatter.locale = Locale(identifier: "en_US_POSIX") + return formatter + }() +}