@@ -16,7 +16,7 @@ public actor AuthClient {
16
16
public var headers : [ String : String ]
17
17
public let flowType : AuthFlowType
18
18
public let localStorage : AuthLocalStorage
19
- public let loggingConfiguration : SupabaseLoggingConfiguration
19
+ public let logger : SupabaseLogger ?
20
20
public let encoder : JSONEncoder
21
21
public let decoder : JSONDecoder
22
22
public let fetch : FetchHandler
@@ -28,7 +28,7 @@ public actor AuthClient {
28
28
/// - headers: Custom headers to be included in requests.
29
29
/// - flowType: The authentication flow type.
30
30
/// - localStorage: The storage mechanism for local data.
31
- /// - loggingConfiguration : The configuration used for the internal logger .
31
+ /// - logger : The logger to use .
32
32
/// - encoder: The JSON encoder to use for encoding requests.
33
33
/// - decoder: The JSON decoder to use for decoding responses.
34
34
/// - fetch: The asynchronous fetch handler for network requests.
@@ -37,7 +37,7 @@ public actor AuthClient {
37
37
headers: [ String : String ] = [ : ] ,
38
38
flowType: AuthFlowType = Configuration . defaultFlowType,
39
39
localStorage: AuthLocalStorage ,
40
- loggingConfiguration : SupabaseLoggingConfiguration = SupabaseLoggingConfiguration ( ) ,
40
+ logger : SupabaseLogger ? = nil ,
41
41
encoder: JSONEncoder = AuthClient . Configuration. jsonEncoder,
42
42
decoder: JSONDecoder = AuthClient . Configuration. jsonDecoder,
43
43
fetch: @escaping FetchHandler = { try await URLSession . shared. data ( for: $0) }
@@ -48,7 +48,7 @@ public actor AuthClient {
48
48
self . headers = headers
49
49
self . flowType = flowType
50
50
self . localStorage = localStorage
51
- self . loggingConfiguration = loggingConfiguration
51
+ self . logger = logger
52
52
self . encoder = encoder
53
53
self . decoder = decoder
54
54
self . fetch = fetch
@@ -79,7 +79,7 @@ public actor AuthClient {
79
79
Dependencies . current. value!. currentDate
80
80
}
81
81
82
- private var logger : SupabaseLogger {
82
+ private var logger : SupabaseLogger ? {
83
83
Dependencies . current. value!. logger
84
84
}
85
85
@@ -102,7 +102,7 @@ public actor AuthClient {
102
102
/// - headers: Custom headers to be included in requests.
103
103
/// - flowType: The authentication flow type..
104
104
/// - localStorage: The storage mechanism for local data..
105
- /// - loggingConfiguration : The configuration used for the internal logger .
105
+ /// - logger : The logger to use .
106
106
/// - encoder: The JSON encoder to use for encoding requests.
107
107
/// - decoder: The JSON decoder to use for decoding responses.
108
108
/// - fetch: The asynchronous fetch handler for network requests.
@@ -111,7 +111,7 @@ public actor AuthClient {
111
111
headers: [ String : String ] = [ : ] ,
112
112
flowType: AuthFlowType = AuthClient . Configuration. defaultFlowType,
113
113
localStorage: AuthLocalStorage ,
114
- loggingConfiguration : SupabaseLoggingConfiguration = SupabaseLoggingConfiguration ( ) ,
114
+ logger : SupabaseLogger ? = nil ,
115
115
encoder: JSONEncoder = AuthClient . Configuration. jsonEncoder,
116
116
decoder: JSONDecoder = AuthClient . Configuration. jsonDecoder,
117
117
fetch: @escaping FetchHandler = { try await URLSession . shared. data ( for: $0) }
@@ -122,7 +122,7 @@ public actor AuthClient {
122
122
headers: headers,
123
123
flowType: flowType,
124
124
localStorage: localStorage,
125
- loggingConfiguration : loggingConfiguration ,
125
+ logger : logger ,
126
126
encoder: encoder,
127
127
decoder: decoder,
128
128
fetch: fetch
@@ -135,7 +135,10 @@ public actor AuthClient {
135
135
/// - Parameters:
136
136
/// - configuration: The client configuration.
137
137
public init ( configuration: Configuration ) {
138
- let api = APIClient . live ( http: HTTPClient ( fetchHandler: configuration. fetch) )
138
+ let api = APIClient . live ( http: HTTPClient (
139
+ logger: configuration. logger,
140
+ fetchHandler: configuration. fetch
141
+ ) )
139
142
140
143
self . init (
141
144
configuration: configuration,
@@ -144,10 +147,7 @@ public actor AuthClient {
144
147
api: api,
145
148
eventEmitter: . live,
146
149
sessionStorage: . live,
147
- logger: SupabaseLogger (
148
- system: " AuthClient " ,
149
- configuration: configuration. loggingConfiguration
150
- )
150
+ logger: configuration. logger
151
151
)
152
152
}
153
153
@@ -159,7 +159,7 @@ public actor AuthClient {
159
159
api: APIClient ,
160
160
eventEmitter: EventEmitter ,
161
161
sessionStorage: SessionStorage ,
162
- logger: SupabaseLogger
162
+ logger: SupabaseLogger ?
163
163
) {
164
164
mfa = AuthMFA ( )
165
165
@@ -189,11 +189,11 @@ public actor AuthClient {
189
189
session: Session ?
190
190
) > {
191
191
let ( id, stream) = eventEmitter. attachListener ( )
192
- logger. debug ( " auth state change listener with id ' \( id. uuidString) ' attached. " )
192
+ logger? . debug ( " auth state change listener with id ' \( id. uuidString) ' attached. " )
193
193
194
194
Task { [ id] in
195
195
await emitInitialSession ( forStreamWithID: id)
196
- logger. debug ( " initial session for listener with id ' \( id. uuidString) ' emitted. " )
196
+ logger? . debug ( " initial session for listener with id ' \( id. uuidString) ' emitted. " )
197
197
}
198
198
199
199
return stream
0 commit comments