@uoa/lambda-tracing 2.2.1 → 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/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
- `accessedBy:${auditInformation.accessedBy.replace(/\s/g, '')} ` +
68
- `action:${auditInformation.action.toString().replace(/\s/g, '')} ` +
69
- `owner:${auditInformation.ownerId.replace(/\s/g, '')} ` +
70
- `resourceType:${auditInformation.resourceType.replace(/\s/g, '')}`;
71
-
72
- // Add optional fields if they exist
73
- if (auditInformation.application) {
74
- logMessage = `application:${auditInformation.application.replace(/\s/g, '')} ` + logMessage;
75
- }
76
- if (auditInformation.resourceId) {
77
- logMessage += ` resourceId:${auditInformation.resourceId.replace(/\s/g, '')}`;
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
- logMessage += ` ${message}`;
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,5 +1,8 @@
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
+
3
6
  ## 2.2.1
4
7
  - Fix formatting in readme
5
8
 
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 = `accessedBy:${auditInformation.accessedBy.replace(/\s/g, '')} ` +
34
- `action:${auditInformation.action.toString().replace(/\s/g, '')} ` +
35
- `owner:${auditInformation.ownerId.replace(/\s/g, '')} ` +
36
- `resourceType:${auditInformation.resourceType.replace(/\s/g, '')}`;
37
- // Add optional fields if they exist
38
- if (auditInformation.application) {
39
- logMessage = `application:${auditInformation.application.replace(/\s/g, '')} ` + logMessage;
40
- }
41
- if (auditInformation.resourceId) {
42
- logMessage += ` resourceId:${auditInformation.resourceId.replace(/\s/g, '')}`;
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.1",
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": [