Files
swift-mirror/userdocs/diagnostics/oslog.md
T
Doug Gregor 454237a083 Allow the OSLog module to specify the log string section name
When building the `OSLog` module, look for a variable named
`osLogStringSectionName`. It must have a string literal as its
initializer, which provides the section name where the log strings
should be emitted. The `OSLog` module should contain something like
this:

    let osLogStringSectionName = "__TEXT,__logit"

When not present, the compiler will default to
`__TEXT,__oslogstring,cstring_literals`, which was previously the
hardcoded section name. Now, OSLog can customize the name.

Implements rdar://171571056
2026-03-09 10:27:54 -07:00

505 B

OSLog module (OSLog)

The OSLog module defines logging facilities that integrate with the Swift compiler. This module is provided by the platform vendor and integrates with the system logging facilities. The Swift OSLog module should provide a module-scope variable declaration that specifies which section the logging strings should be emitted into. For example:

let osLogStringSectionName = "__TEXT,__logstrings"

The initializer of osLogStringSectionName must be a string literal.