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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,68 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
7
+
## [1.8.0] - 2025-04-22
8
+
9
+
### Added
10
+
11
+
- Added support to add single `transport` or multiple transport using key `transports`. The transport parameter allows you to implement custom logging behavior by providing your own logging functions.
12
+
13
+
```python
14
+
from vwo import init
15
+
16
+
classCustomTransport:
17
+
def__init__(self, config):
18
+
self.level = config.get('level', "ERROR")
19
+
self.config = config
20
+
21
+
deflog(self, level, message):
22
+
# your custom implementation here
23
+
24
+
options = {
25
+
'sdk_key': '32-alpha-numeric-sdk-key', # SDK Key
26
+
'account_id': '123456', # VWO Account ID
27
+
'logger' {
28
+
'transport': CustomTransport({'level': 'INFO'})
29
+
}
30
+
}
31
+
32
+
vwo_client = init(options)
33
+
```
34
+
35
+
- For multiple transports you can use the `transports` parameter. For example:
Copy file name to clipboardExpand all lines: README.md
+81-9Lines changed: 81 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,6 +240,24 @@ options = {
240
240
vwo_client = init(options)
241
241
```
242
242
243
+
### Integrations
244
+
VWO FME SDKs provide seamless integration with third-party tools like analytics platforms, monitoring services, customer data platforms (CDPs), and messaging systems. This is achieved through a simple yet powerful callback mechanism that receives VWO-specific properties and can forward them to any third-party tool of your choice.
245
+
246
+
```python
247
+
defcallback(properties):
248
+
# properties will contain all the required VWO specific information
249
+
print(properties)
250
+
251
+
options = {
252
+
'sdk_key': '32-alpha-numeric-sdk-key', # SDK Key
253
+
'account_id': '12345', # VWO Account ID
254
+
'integrations': {
255
+
'callback': callback
256
+
}
257
+
}
258
+
vwo_client = init(options)
259
+
```
260
+
243
261
### Logger
244
262
245
263
VWO by default logs all `ERROR` level messages to your server console.
@@ -249,6 +267,7 @@ To gain more control over VWO's logging behaviour, you can use the `logger` para
|`level`| Log level to control verbosity of logs | Yes | str |`ERROR`|
251
269
|`prefix`| Custom prefix for log messages | No | str |`VWO-SDK`|
270
+
|`transport`| Custom logger implementation | No | object | See example below |
252
271
253
272
#### Example 1: Set log level to control verbosity of logs
254
273
@@ -277,21 +296,74 @@ options = {
277
296
vwo_client = init(options)
278
297
```
279
298
280
-
### Integrations
281
-
VWO FME SDKs provide seamless integration with third-party tools like analytics platforms, monitoring services, customer data platforms (CDPs), and messaging systems. This is achieved through a simple yet powerful callback mechanism that receives VWO-specific properties and can forward them to any third-party tool of your choice.
299
+
#### Example 3: Implement custom transport to handle logs your way
282
300
301
+
The `transport` parameter allows you to implement custom logging behavior by providing your own logging functions. You can define handlers for different log levels (`debug`, `info`, `warn`, `error`, `trace`) to process log messages according to your needs.
302
+
303
+
For example, you could:
304
+
305
+
- Send logs to a third-party logging service
306
+
- Write logs to a file
307
+
- Format log messages differently
308
+
- Filter or transform log messages
309
+
- Route different log levels to different destinations
310
+
311
+
The transport object should implement handlers for the log levels you want to customize. Each handler receives the log message as a parameter.
312
+
313
+
For single transport you can use the `transport` parameter. For example:
283
314
```python
284
-
defcallback(properties):
285
-
# properties will contain all the required VWO specific information
286
-
print(properties)
315
+
from vwo import init
316
+
317
+
classCustomTransport:
318
+
def__init__(self, config):
319
+
self.level = config.get('level', "ERROR")
320
+
self.config = config
321
+
322
+
deflog(self, level, message):
323
+
# your custom implementation here
287
324
288
325
options = {
289
326
'sdk_key': '32-alpha-numeric-sdk-key', # SDK Key
290
-
'account_id': '12345', # VWO Account ID
291
-
'integrations': {
292
-
'callback': callback
327
+
'account_id': '123456', # VWO Account ID
328
+
'logger' {
329
+
'transport': CustomTransport({'level': 'INFO'})
293
330
}
294
331
}
332
+
333
+
vwo_client = init(options)
334
+
```
335
+
336
+
For multiple transports you can use the `transports` parameter. For example:
337
+
```python
338
+
from vwo import init
339
+
340
+
classCustomTransportForInfo:
341
+
def__init__(self, config):
342
+
self.level = config.get('level', "INFO")
343
+
self.config = config
344
+
345
+
deflog(self, level, message):
346
+
# your custom implementation here
347
+
348
+
classCustomTransportForError:
349
+
def__init__(self, config):
350
+
self.level = config.get('level', "ERROR")
351
+
self.config = config
352
+
353
+
deflog(self, level, message):
354
+
# your custom implementation here
355
+
356
+
options = {
357
+
'sdk_key': '32-alpha-numeric-sdk-key', # SDK Key
358
+
'account_id': '123456', # VWO Account ID
359
+
'logger' {
360
+
'transports': [
361
+
CustomTransportForInfo({'level': 'INFO'}),
362
+
CustomTransportForError({'level': 'ERROR'})
363
+
]
364
+
}
365
+
}
366
+
295
367
vwo_client = init(options)
296
368
```
297
369
@@ -328,4 +400,4 @@ Our [Code of Conduct](https://github.com/wingify/vwo-fme-python-sdk/blob/master/
328
400
329
401
[Apache License, Version 2.0](https://github.com/wingify/vwo-fme-python-sdk/blob/master/LICENSE)
0 commit comments