mirror of
https://github.com/apple/swift-log
synced 2026-11-27 04:14:20 +00:00
Motivation: Right now, we use the full path (`#file`) for the logging as well as for parsing out the module name (which goes into `source` by default). This has two problems: 1. The file names contain the build server's full path, ie. aren't portable across different compiles (and are very long). 2. The module name parsing fails if we log from a file that's not in a directory named just like the module. Modification: Switch `#file` for `#fileID`. This changes a bunch of things: - `source` is always the module name by default (great!) - `file` changes from `/the/full/path/on/disk` to `ModuleName/FileBaseName.swift` (I think better, but it's a change) Result: `source` is more correct, `file` will be different.
26 lines
802 B
Swift
26 lines
802 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift Logging API open source project
|
|
//
|
|
// Copyright (c) 2021 Apple Inc. and the Swift Logging API project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import Logging
|
|
|
|
internal func emitLogMessage(_ message: Logger.Message, to logger: Logger) {
|
|
logger.trace(message)
|
|
logger.debug(message)
|
|
logger.info(message)
|
|
logger.notice(message)
|
|
logger.warning(message)
|
|
logger.error(message)
|
|
logger.critical(message)
|
|
}
|