@crimson-education/browser-logger 1.0.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/README.md +56 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Crimson Education Browser Logger
|
|
2
|
+
|
|
3
|
+
An abstract logger and reporting utility for browser environments
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @crimson-education/browser-logger
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @crimson-education/browser-logger
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import * as Logger from '@crimson-education/browser-logger';
|
|
21
|
+
|
|
22
|
+
Logger.init({
|
|
23
|
+
service: 'browser-project',
|
|
24
|
+
environment: config.environment,
|
|
25
|
+
version: config.version,
|
|
26
|
+
browserHistory: history,
|
|
27
|
+
|
|
28
|
+
sentry: {
|
|
29
|
+
dsn: config.sentryDsn,
|
|
30
|
+
proxyUrl: config.sentryTunnelProxyUrl,
|
|
31
|
+
release: config.sentryRelease,
|
|
32
|
+
allowUrls: [/subdomain\.crimsoneducation\.org/],
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
datadog: {
|
|
36
|
+
applicationId: config.datadogApplicationId,
|
|
37
|
+
clientToken: config.datadogClientToken,
|
|
38
|
+
site: config.datadogSite,
|
|
39
|
+
proxyUrl: config.datadogTunnelProxyUrl,
|
|
40
|
+
version: config.datadogVersion,
|
|
41
|
+
forwardConsoleLogs: true,
|
|
42
|
+
trackInteractions: true,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Must init before you can create a logger.
|
|
47
|
+
const logger = Logger.createLogger();
|
|
48
|
+
|
|
49
|
+
// Once the user is authenticated.
|
|
50
|
+
Logger.recordSession();
|
|
51
|
+
|
|
52
|
+
// Attributed logging.
|
|
53
|
+
logger.info('WOW!', {
|
|
54
|
+
id: 1,
|
|
55
|
+
});
|
|
56
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@crimson-education/browser-logger",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "An abstract logger and reporting utility for browser environments",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"prepack": "npm run build",
|
|
7
|
+
"clean": "rimraf lib",
|
|
8
|
+
"prebuild": "npm run clean",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"lint": "eslint src",
|
|
11
|
+
"fixlint": "npm run lint -- --fix"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/crimson-education/browser-logger.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"logger",
|
|
19
|
+
"analytics",
|
|
20
|
+
"rum"
|
|
21
|
+
],
|
|
22
|
+
"author": "Crimson Education",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/crimson-education/browser-logger/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/crimson-education/browser-logger#readme",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@datadog/browser-logs": "^4.4.0",
|
|
30
|
+
"@datadog/browser-rum": "^4.4.0",
|
|
31
|
+
"@sentry/react": "^6.17.9",
|
|
32
|
+
"@sentry/tracing": "^6.17.9"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@crimson-education/eslint-config": "^2.1.0",
|
|
36
|
+
"eslint": "^7.20.0",
|
|
37
|
+
"eslint-config-prettier": "^8.3.0",
|
|
38
|
+
"rimraf": "^3.0.2",
|
|
39
|
+
"typescript": "^4.1.2"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"lib"
|
|
43
|
+
],
|
|
44
|
+
"main": "lib/index.js"
|
|
45
|
+
}
|