Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,24 @@ public let benchmarks: @Sendable () -> Void = {
makeBenchmark(loggerLevel: .warning, logLevel: .warning, "_generic") { logger in
logger.log(level: .warning, "hello, benchmarking world")
}
makeBenchmark(loggerLevel: .notice, logLevel: .notice, "_attributed_generic") { logger in
logger.log(
level: .notice,
"hello, benchmarking world",
attributedMetadata: [
"public-key": "\("public-value", privacy: .public)",
"private-key": "\("private-value", privacy: .private)",
]
)
}
makeBenchmark(loggerLevel: .warning, logLevel: .warning, "_attributed_generic") { logger in
logger.log(
level: .warning,
"hello, benchmarking world",
attributedMetadata: [
"public-key": "\("public-value", privacy: .public)",
"private-key": "\("private-value", privacy: .private)",
]
)
}
}
20 changes: 20 additions & 0 deletions Benchmarks/NoTraits/Benchmarks/NoTraitsBenchmarks/NoTraits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,24 @@ public let benchmarks: @Sendable () -> Void = {
makeBenchmark(loggerLevel: .error, logLevel: .debug, "_generic") { logger in
logger.log(level: .debug, "hello, benchmarking world")
}
makeBenchmark(loggerLevel: .error, logLevel: .error, "_attributed_generic") { logger in
logger.log(
level: .error,
"hello, benchmarking world",
attributedMetadata: [
"public-key": "\("public-value", privacy: .public)",
"private-key": "\("private-value", privacy: .private)",
]
)
}
makeBenchmark(loggerLevel: .error, logLevel: .debug, "_attributed_generic") { logger in
logger.log(
level: .debug,
"hello, benchmarking world",
attributedMetadata: [
"public-key": "\("public-value", privacy: .public)",
"private-key": "\("private-value", privacy: .private)",
]
)
}
}
9 changes: 9 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let package = Package(
products: [
.library(name: "Logging", targets: ["Logging"]),
.library(name: "InMemoryLogging", targets: ["InMemoryLogging"]),
.library(name: "OSLogLogHandler", targets: ["OSLogLogHandler"]),
],
traits: [
.trait(name: "MaxLogLevelDebug", description: "Debug and above available (compiles out trace)"),
Expand Down Expand Up @@ -48,6 +49,10 @@ let package = Package(
name: "InMemoryLogging",
dependencies: ["Logging"]
),
.target(
name: "OSLogLogHandler",
dependencies: ["Logging"]
),
.testTarget(
name: "LoggingTests",
dependencies: ["Logging"]
Expand All @@ -56,6 +61,10 @@ let package = Package(
name: "InMemoryLoggingTests",
dependencies: ["InMemoryLogging", "Logging"]
),
.testTarget(
name: "OSLogLogHandlerTests",
dependencies: ["OSLogLogHandler", "Logging"]
),
]
)

Expand Down
Loading