You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// The internal logger to use when reporting misconfiguration and background activity.
40
-
nonisolatedletlogger:Logger
40
+
nonisolatedletbackgroundActivityLogger:Logger
41
41
42
42
/// The internal executor to use when delivering messages.
43
43
varexecutor:Executor
@@ -57,15 +57,15 @@ public actor WebPushManager: Sendable {
57
57
/// - Note: On debug builds, this initializer will assert if VAPID authorization header expiration times are inconsistently set.
58
58
/// - Parameters:
59
59
/// - vapidConfiguration: The VAPID configuration to use when identifying the application server.
60
-
/// - logger: The logger to use for misconfiguration and background activity. By default, a print logger will be used, and if set to `nil`, a no-op logger will be used in release builds. When running in a server environment, your shared logger should be used instead giving you full control of logging.
60
+
/// - backgroundActivityLogger: The logger to use for misconfiguration and background activity. By default, a print logger will be used, and if set to `nil`, a no-op logger will be used in release builds. When running in a server environment, your shared logger should be used instead giving you full control of logging.
61
61
/// - eventLoopGroupProvider: The event loop to use for the internal HTTP client.
62
62
publicinit(
63
63
vapidConfiguration:VAPID.Configuration,
64
64
// TODO: Add networkConfiguration for proxy, number of simultaneous pushes, etc…
@@ -96,21 +96,21 @@ public actor WebPushManager: Sendable {
96
96
/// Note that this must be called before ``run()`` is called or the client's syncShutdown won't be called.
97
97
/// - Parameters:
98
98
/// - vapidConfiguration: The VAPID configuration to use when identifying the application server.
99
-
/// - logger: The logger to use for status updates.
99
+
/// - backgroundActivityLogger: The logger to use for misconfiguration and background activity.
100
100
/// - executor: The executor to use when sending push messages.
101
101
packageinit(
102
102
vapidConfiguration:VAPID.Configuration,
103
103
// TODO: Add networkConfiguration for proxy, number of simultaneous pushes, etc…
104
-
logger:Logger,
104
+
backgroundActivityLogger:Logger,
105
105
executor:Executor
106
106
){
107
107
if vapidConfiguration.validityDuration > vapidConfiguration.expirationDuration {
108
108
assertionFailure("The validity duration must be earlier than the expiration duration since it represents when the VAPID Authorization token will be refreshed ahead of it expiring.")
109
-
logger.error("The validity duration must be earlier than the expiration duration since it represents when the VAPID Authorization token will be refreshed ahead of it expiring. Run your application server with the same configuration in debug mode to catch this.")
109
+
backgroundActivityLogger.error("The validity duration must be earlier than the expiration duration since it represents when the VAPID Authorization token will be refreshed ahead of it expiring. Run your application server with the same configuration in debug mode to catch this.")
110
110
}
111
111
if vapidConfiguration.expirationDuration >.hours(24){
112
112
assertionFailure("The expiration duration must be less than 24 hours or else push endpoints will reject messages sent to them.")
113
-
logger.error("The expiration duration must be less than 24 hours or else push endpoints will reject messages sent to them. Run your application server with the same configuration in debug mode to catch this.")
113
+
backgroundActivityLogger.error("The expiration duration must be less than 24 hours or else push endpoints will reject messages sent to them. Run your application server with the same configuration in debug mode to catch this.")
114
114
}
115
115
precondition(!vapidConfiguration.keys.isEmpty,"VAPID.Configuration must have keys specified. Please report this as a bug with reproduction steps if encountered: https://github.com/mochidev/swift-webpush/issues.")
116
116
@@ -120,7 +120,7 @@ public actor WebPushManager: Sendable {
logger.warning("Push message is longer than the maximum guarantee made by the spec: \(Self.maximumMessageSize) bytes. Sending this message may fail, and its size will be leaked despite being encrypted. Please consider sending less data to keep your communications secure.", metadata:["message":"\(message)"])
377
+
backgroundActivityLogger.warning("Push message is longer than the maximum guarantee made by the spec: \(Self.maximumMessageSize) bytes. Sending this message may fail, and its size will be leaked despite being encrypted. Please consider sending less data to keep your communications secure.", metadata:["message":"\(message)"])
378
378
}
379
379
380
380
/// Prepare the payload by padding it so the final message is 4KB.
@@ -424,9 +424,9 @@ public actor WebPushManager: Sendable {
logger.error("The message expiration must be greater than or equal to \(Expiration.dropIfUndeliverable) seconds.", metadata:["expiration":"\(expiration)"])
427
+
backgroundActivityLogger.error("The message expiration must be greater than or equal to \(Expiration.dropIfUndeliverable) seconds.", metadata:["expiration":"\(expiration)"])
logger.warning("The message expiration should be less than \(Expiration.recommendedMaximum) seconds.", metadata:["expiration":"\(expiration)"])
429
+
backgroundActivityLogger.warning("The message expiration should be less than \(Expiration.recommendedMaximum) seconds.", metadata:["expiration":"\(expiration)"])
430
430
}
431
431
432
432
/// Add the VAPID authorization and corrent content encoding and type.
@@ -440,7 +440,7 @@ public actor WebPushManager: Sendable {
0 commit comments