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: README.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@ logger.log(obj);
54
54
***compress** - If true the the logs are compressed in gzip format. Default: `false`
55
55
***internalLogger** - set internal logger that supports the function log. Default: console.
56
56
***extraFields** - Adds your own custom fields to each log. Add in JSON Format, for example: `extraFields : { field_1: "val_1", field_2: "val_2" , ... }`.
57
+
***addOtelContext** - Add `trace_id`, `span_id`, `service_name` fields to logs when opentelemetry context is available. Default: `true`
57
58
58
59
59
60
## Using UDP
@@ -99,6 +100,17 @@ logger.log('This is a log message');
99
100
}
100
101
```
101
102
103
+
## Add opentelemetry context
104
+
If you're sending traces with OpenTelemetry instrumentation (auto or manual), you can correlate your logs with the trace context. That way, your logs will have traces data in it, such as service name, span id and trace id (version >= `2.2.0`). This feature is enabled by default, To disable it, set the `AddOtelContext` param in your handler configuration to `false`, like in this example:
105
+
106
+
```javascript
107
+
var logger =require('logzio-nodejs').createLogger({
108
+
token:'token',
109
+
type:'no-otel-context',
110
+
addOtelContext:false
111
+
});
112
+
```
113
+
102
114
## Build and test locally
103
115
1. Clone the repository:
104
116
```bash
@@ -112,6 +124,10 @@ logger.log('This is a log message');
112
124
```
113
125
114
126
## Update log
127
+
**2.2.0**
128
+
- Add `addOtelContext` configuration option:
129
+
-`trace_id`, `span_id`, `service_name` fields to logs when opentelemetry context is available.
130
+
115
131
**2.1.8**
116
132
- Make `User-Agent` not optional and add the version to it.
0 commit comments