@coralogix/browser 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +20 -2
- package/index.esm2.js +20 -16
- package/package.json +1 -1
- package/src/instrumentations/CoralogixCustomLogInstrumentation.d.ts +9 -1
- package/src/types.d.ts +7 -7
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
28. [CDN](#cdn)
|
|
55
55
|
|
|
56
56
|
- [Specific Version](#specific-version-recommended)
|
|
57
|
-
- [Latest Version](#latest-version)
|
|
58
57
|
- [Add the CDN Script to Your Application](#add-the-cdn-script-to-your-application)
|
|
59
58
|
- [Initialization](#initialization)
|
|
60
59
|
- [Via JS File](#via-js-file)
|
|
@@ -196,11 +195,30 @@ CoralogixRum.init({
|
|
|
196
195
|
```javascript
|
|
197
196
|
import { CoralogixRum, CoralogixLogSeverity } from '@coralogix/browser';
|
|
198
197
|
|
|
198
|
+
// send custom logs with different severity levels
|
|
199
199
|
CoralogixRum.log(CoralogixLogSeverity.Info, 'this is a custom log');
|
|
200
200
|
|
|
201
|
+
// send custom logs with extra data
|
|
201
202
|
CoralogixRum.log(CoralogixLogSeverity.Error, 'this is an error custom log with extra data', { data: 'tbd' });
|
|
202
203
|
|
|
204
|
+
// send custom logs with extra data, call the error severity log directly
|
|
203
205
|
CoralogixRum.error('this is a custom log with error severity', { data: 'tbd' });
|
|
206
|
+
|
|
207
|
+
// send custom logs with extra data and labels
|
|
208
|
+
CoralogixRum.warning(
|
|
209
|
+
'this is a custom log message with warning severity',
|
|
210
|
+
{
|
|
211
|
+
data: 'tbd',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
my_label_key: 'my label value',
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
// data is optional unless labels are provided, in which case data is required (can be null
|
|
219
|
+
CoralogixRum.log(CoralogixLogSeverity.Info, 'this is a custom log message with info severity', null, {
|
|
220
|
+
my_label_key: 'my label value',
|
|
221
|
+
});
|
|
204
222
|
```
|
|
205
223
|
|
|
206
224
|
### Instrumentation's
|
|
@@ -870,7 +888,7 @@ Coralogix Browser SDK is also provided for Flutter web.
|
|
|
870
888
|
Add the following CDN to your `index.html` file:
|
|
871
889
|
|
|
872
890
|
```javascript
|
|
873
|
-
<script src="https://cdn.rum-ingress-coralogix.com/coralogix/browser/
|
|
891
|
+
<script src="https://cdn.rum-ingress-coralogix.com/coralogix/browser/[version]/coralogix-browser-sdk.js"></script>
|
|
874
892
|
```
|
|
875
893
|
|
|
876
894
|
Then, in your Dart code, you can use the SDK as follows:
|
package/index.esm2.js
CHANGED
|
@@ -1148,7 +1148,8 @@ var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
|
|
|
1148
1148
|
CoralogixCustomLogInstrumentation.prototype.init = function () { };
|
|
1149
1149
|
CoralogixCustomLogInstrumentation.prototype.disable = function () { };
|
|
1150
1150
|
CoralogixCustomLogInstrumentation.prototype.enable = function () { };
|
|
1151
|
-
CoralogixCustomLogInstrumentation.prototype.log = function (
|
|
1151
|
+
CoralogixCustomLogInstrumentation.prototype.log = function (_a) {
|
|
1152
|
+
var severity = _a.severity, message = _a.message, data = _a.data, labels = _a.labels;
|
|
1152
1153
|
var span = this.tracer.startSpan(CoralogixEventType.LOG);
|
|
1153
1154
|
span.setAttribute(CoralogixAttributes.EVENT_TYPE, CoralogixEventType.LOG);
|
|
1154
1155
|
span.setAttribute(CoralogixAttributes.SOURCE, LogSource.CODE);
|
|
@@ -1160,6 +1161,9 @@ var CoralogixCustomLogInstrumentation = /** @class */ (function (_super) {
|
|
|
1160
1161
|
? JSON.stringify(data, getCircularReplacer())
|
|
1161
1162
|
: data,
|
|
1162
1163
|
}));
|
|
1164
|
+
if (labels) {
|
|
1165
|
+
setCustomLabelsForSpan(span, labels);
|
|
1166
|
+
}
|
|
1163
1167
|
span.end();
|
|
1164
1168
|
};
|
|
1165
1169
|
return CoralogixCustomLogInstrumentation;
|
|
@@ -4134,7 +4138,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
4134
4138
|
return resolvedUrlBlueprinters;
|
|
4135
4139
|
}
|
|
4136
4140
|
|
|
4137
|
-
var SDK_VERSION = '2.
|
|
4141
|
+
var SDK_VERSION = '2.4.0';
|
|
4138
4142
|
|
|
4139
4143
|
function shouldDropEvent(cxRumEvent, options) {
|
|
4140
4144
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4952,7 +4956,7 @@ var CoralogixRum = {
|
|
|
4952
4956
|
var _a, _b;
|
|
4953
4957
|
return (_b = (_a = getSessionManager()) === null || _a === undefined ? undefined : _a.getSession()) === null || _b === undefined ? undefined : _b.sessionId;
|
|
4954
4958
|
},
|
|
4955
|
-
log: function (severity, message, data) {
|
|
4959
|
+
log: function (severity, message, data, labels) {
|
|
4956
4960
|
if (!isInited) {
|
|
4957
4961
|
console.debug('CoralogixRum must be initiated before using log');
|
|
4958
4962
|
return;
|
|
@@ -4961,25 +4965,25 @@ var CoralogixRum = {
|
|
|
4961
4965
|
console.warn('Log was reported, but custom instrumentation is disabled.');
|
|
4962
4966
|
return;
|
|
4963
4967
|
}
|
|
4964
|
-
_customInstrumentation === null || _customInstrumentation === undefined ? undefined : _customInstrumentation.log(severity, message, data);
|
|
4968
|
+
_customInstrumentation === null || _customInstrumentation === undefined ? undefined : _customInstrumentation.log({ severity: severity, message: message, data: data, labels: labels });
|
|
4965
4969
|
},
|
|
4966
|
-
debug: function (message, data) {
|
|
4967
|
-
this.log(CoralogixLogSeverity.Debug, message, data);
|
|
4970
|
+
debug: function (message, data, labels) {
|
|
4971
|
+
this.log(CoralogixLogSeverity.Debug, message, data, labels);
|
|
4968
4972
|
},
|
|
4969
|
-
verbose: function (message, data) {
|
|
4970
|
-
this.log(CoralogixLogSeverity.Verbose, message, data);
|
|
4973
|
+
verbose: function (message, data, labels) {
|
|
4974
|
+
this.log(CoralogixLogSeverity.Verbose, message, data, labels);
|
|
4971
4975
|
},
|
|
4972
|
-
info: function (message, data) {
|
|
4973
|
-
this.log(CoralogixLogSeverity.Info, message, data);
|
|
4976
|
+
info: function (message, data, labels) {
|
|
4977
|
+
this.log(CoralogixLogSeverity.Info, message, data, labels);
|
|
4974
4978
|
},
|
|
4975
|
-
warn: function (message, data) {
|
|
4976
|
-
this.log(CoralogixLogSeverity.Warn, message, data);
|
|
4979
|
+
warn: function (message, data, labels) {
|
|
4980
|
+
this.log(CoralogixLogSeverity.Warn, message, data, labels);
|
|
4977
4981
|
},
|
|
4978
|
-
error: function (message, data) {
|
|
4979
|
-
this.log(CoralogixLogSeverity.Error, message, data);
|
|
4982
|
+
error: function (message, data, labels) {
|
|
4983
|
+
this.log(CoralogixLogSeverity.Error, message, data, labels);
|
|
4980
4984
|
},
|
|
4981
|
-
critical: function (message, data) {
|
|
4982
|
-
this.log(CoralogixLogSeverity.Critical, message, data);
|
|
4985
|
+
critical: function (message, data, labels) {
|
|
4986
|
+
this.log(CoralogixLogSeverity.Critical, message, data, labels);
|
|
4983
4987
|
},
|
|
4984
4988
|
startTimeMeasure: function (key, labels) {
|
|
4985
4989
|
if (!isInited) {
|
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
2
2
|
import { CoralogixLogSeverity } from '../types-external';
|
|
3
|
+
import { CoralogixRumLabels } from '../types';
|
|
3
4
|
export declare const CUSTOM_INSTRUMENTATION_VERSION = "1";
|
|
4
5
|
export declare enum LogSource {
|
|
5
6
|
CODE = "code"
|
|
6
7
|
}
|
|
8
|
+
interface CustomLogParams {
|
|
9
|
+
severity: CoralogixLogSeverity;
|
|
10
|
+
message: string;
|
|
11
|
+
data?: any;
|
|
12
|
+
labels?: CoralogixRumLabels;
|
|
13
|
+
}
|
|
7
14
|
export declare class CoralogixCustomLogInstrumentation extends InstrumentationBase {
|
|
8
15
|
private stringifyCustomLogData;
|
|
9
16
|
constructor(config: InstrumentationConfig);
|
|
10
17
|
protected init(): void;
|
|
11
18
|
disable(): void;
|
|
12
19
|
enable(): void;
|
|
13
|
-
log(severity
|
|
20
|
+
log({ severity, message, data, labels }: CustomLogParams): void;
|
|
14
21
|
}
|
|
22
|
+
export {};
|
package/src/types.d.ts
CHANGED
|
@@ -106,13 +106,13 @@ export interface CoralogixOtelWebOptionsInstrumentations {
|
|
|
106
106
|
web_vitals?: boolean | CoralogixWebVitalsInstrumentationConfig;
|
|
107
107
|
}
|
|
108
108
|
interface SendLog {
|
|
109
|
-
log: (severity: CoralogixLogSeverity, message: string, data?: any) => void;
|
|
110
|
-
debug: (message: string, data?: any) => void;
|
|
111
|
-
verbose: (message: string, data?: any) => void;
|
|
112
|
-
info: (message: string, data?: any) => void;
|
|
113
|
-
warn: (message: string, data?: any) => void;
|
|
114
|
-
error: (message: string, data?: any) => void;
|
|
115
|
-
critical: (message: string, data?: any) => void;
|
|
109
|
+
log: (severity: CoralogixLogSeverity, message: string, data?: any, labels?: CoralogixRumLabels) => void;
|
|
110
|
+
debug: (message: string, data?: any, labels?: CoralogixRumLabels) => void;
|
|
111
|
+
verbose: (message: string, data?: any, labels?: CoralogixRumLabels) => void;
|
|
112
|
+
info: (message: string, data?: any, labels?: CoralogixRumLabels) => void;
|
|
113
|
+
warn: (message: string, data?: any, labels?: CoralogixRumLabels) => void;
|
|
114
|
+
error: (message: string, data?: any, labels?: CoralogixRumLabels) => void;
|
|
115
|
+
critical: (message: string, data?: any, labels?: CoralogixRumLabels) => void;
|
|
116
116
|
}
|
|
117
117
|
export type UrlBlueprinter = (url: string) => string;
|
|
118
118
|
export interface UrlBlueprinters {
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.4.0";
|