@uoa/lambda-tracing 2.2.0 → 2.2.2
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/ReleaseSteps.md +3 -2
- package/UoaLogger.ts +18 -16
- package/changelog.md +7 -0
- package/dist/UoaLogger.js +10 -11
- package/package.json +16 -1
- package/readme.md +1 -2
package/ReleaseSteps.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Steps to release package to npm
|
|
2
2
|
1. `npm login`
|
|
3
3
|
2. `npm version <new version>`
|
|
4
|
-
3.
|
|
5
|
-
4.
|
|
4
|
+
3. Update changelog.md & commit the changes
|
|
5
|
+
4. Push to git to sync new tags
|
|
6
|
+
5. `npm publish --access=public --otp=<2FA code>`
|
|
6
7
|
|
|
7
8
|
# Testing locally before release
|
|
8
9
|
1. `npm pack`
|
package/UoaLogger.ts
CHANGED
|
@@ -64,26 +64,28 @@ export class UoaLogger {
|
|
|
64
64
|
public audit(auditInformation: AuditInformation, message?: string): void {
|
|
65
65
|
// Initialize logMessage with mandatory fields
|
|
66
66
|
let logMessage: string =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
`application:${
|
|
68
|
+
auditInformation.application
|
|
69
|
+
? auditInformation.application.replace(/\s/g, "")
|
|
70
|
+
: "-"
|
|
71
|
+
} ` +
|
|
72
|
+
`accessedBy:${auditInformation.accessedBy.replace(/\s/g, "")} ` +
|
|
73
|
+
`action:${auditInformation.action.toString().replace(/\s/g, "")} ` +
|
|
74
|
+
`owner:${auditInformation.ownerId.replace(/\s/g, "")} ` +
|
|
75
|
+
`resourceType:${auditInformation.resourceType.replace(/\s/g, "")} ` +
|
|
76
|
+
`resourceId:${
|
|
77
|
+
auditInformation.resourceId
|
|
78
|
+
? auditInformation.resourceId.replace(/\s/g, "")
|
|
79
|
+
: "-"
|
|
80
|
+
}`;
|
|
81
|
+
|
|
80
82
|
// Append additional message if provided
|
|
81
83
|
if (message) {
|
|
82
|
-
|
|
84
|
+
logMessage += ` ${message}`;
|
|
83
85
|
}
|
|
84
|
-
|
|
86
|
+
|
|
85
87
|
this.logger.log("audit", logMessage);
|
|
86
|
-
|
|
88
|
+
}
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Function to log warn level messages.
|
package/changelog.md
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.2.2
|
|
4
|
+
- Change behaviour for optional audit parameters. Instead of removing empty optional parameters, they will be present with a hyphen ("-").
|
|
5
|
+
|
|
6
|
+
## 2.2.1
|
|
7
|
+
- Fix formatting in readme
|
|
8
|
+
|
|
3
9
|
## 2.2.0
|
|
4
10
|
- Added audit level to logger
|
|
11
|
+
- The logger debug, info, warn, and error functions now require a string input
|
|
5
12
|
|
|
6
13
|
## 2.1.2
|
|
7
14
|
- Updated XML response parsing to include attribute tags
|
package/dist/UoaLogger.js
CHANGED
|
@@ -30,17 +30,16 @@ class UoaLogger {
|
|
|
30
30
|
*/
|
|
31
31
|
audit(auditInformation, message) {
|
|
32
32
|
// Initialize logMessage with mandatory fields
|
|
33
|
-
let logMessage = `
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
33
|
+
let logMessage = `application:${auditInformation.application
|
|
34
|
+
? auditInformation.application.replace(/\s/g, "")
|
|
35
|
+
: "-"} ` +
|
|
36
|
+
`accessedBy:${auditInformation.accessedBy.replace(/\s/g, "")} ` +
|
|
37
|
+
`action:${auditInformation.action.toString().replace(/\s/g, "")} ` +
|
|
38
|
+
`owner:${auditInformation.ownerId.replace(/\s/g, "")} ` +
|
|
39
|
+
`resourceType:${auditInformation.resourceType.replace(/\s/g, "")} ` +
|
|
40
|
+
`resourceId:${auditInformation.resourceId
|
|
41
|
+
? auditInformation.resourceId.replace(/\s/g, "")
|
|
42
|
+
: "-"}`;
|
|
44
43
|
// Append additional message if provided
|
|
45
44
|
if (message) {
|
|
46
45
|
logMessage += ` ${message}`;
|
package/package.json
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uoa/lambda-tracing",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Library for logging & distributed tracing in UoA Lambda projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+ssh://git@bitbucket.org/uoa/lambda-tracing.git"
|
|
8
8
|
},
|
|
9
9
|
"author": "Mitchell Faulconbridge <mitchell.faulconbridge@auckland.ac.nz>",
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "Mitchell Faulconbridge",
|
|
13
|
+
"email": "mitchell.faulconbridge@auckland.ac.nz"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "Wenlai Wang",
|
|
17
|
+
"email": "w.wang@auckland.ac.nz"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "Osama Kashif",
|
|
21
|
+
"email": "osama.kashif@auckland.ac.nz",
|
|
22
|
+
"url": "https://www.linkedin.com/in/osamakashif"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
10
25
|
"license": "MIT",
|
|
11
26
|
"homepage": "https://bitbucket.org/uoa/lambda-tracing#readme",
|
|
12
27
|
"keywords": [
|
package/readme.md
CHANGED
|
@@ -126,8 +126,7 @@ logger.audit({application: "applicationName", action: "read", resourceId: "12345
|
|
|
126
126
|
```
|
|
127
127
|
Will produce the following log message:
|
|
128
128
|
```text
|
|
129
|
-
2024-04-12T00:58:05.321Z [-] AUDIT src.controller.person-controller - [[[TraceId,SpanId,Info]]] application:applicationName accessedBy:upi1234 action:read owner:upi5678
|
|
130
|
-
resourceType:personalDetails resourceId:123456789 Additional useful info
|
|
129
|
+
2024-04-12T00:58:05.321Z [-] AUDIT src.controller.person-controller - [[[TraceId,SpanId,Info]]] application:applicationName accessedBy:upi1234 action:read owner:upi5678 resourceType:personalDetails resourceId:123456789 Additional useful info
|
|
131
130
|
```
|
|
132
131
|
|
|
133
132
|
### Distributed Tracing
|