Instance Methodswift-package-manager 6.0.3Basics
emit(severity:message:metadata:)
Observability.swift:172func emit(severity: Diagnostic.Severity, message: String, metadata: ObservabilityMetadata? = .none)
func emit(severity: Diagnostic.Severity, message: String, metadata: ObservabilityMetadata? = .none)
s6Basics26DiagnosticsEmitterProtocolPAAE4emit8severity7message8metadatayAA10DiagnosticV8SeverityO_SSAA21ObservabilityMetadataVSgtF
What are these?97J7T
import Basics
protocol DiagnosticsEmitterProtocol
struct Diagnostic
enum Severity
@frozen struct String
A Unicode string value that is a collection of characters.
struct ObservabilityMetadata
Provides type-safe access to the ObservabilityMetadata’s values. This API should ONLY be used inside of accessor implementations.
func emit(_ diagnostics: [Diagnostic])
func emit(_ error: Error, metadata: ObservabilityMetadata? = .none)
func emit(debug message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(debug message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(error message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(error message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(info message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(info message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(warning message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(warning message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
@discardableResult func trap(_ closure: () throws -> Void) -> Bool
trap a throwing closure, emitting diagnostics on error and returning boolean representing success
func trap<T>(_ closure: () throws -> T) -> T?
trap a throwing closure, emitting diagnostics on error and returning the value returned by the closure