h1v3 0.6.1 → 0.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h1v3",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -19,8 +19,8 @@ export function configureConfigStore(paths, _onValueWritten, _logger) {
19
19
 
20
20
  function decideSeverity(newData) {
21
21
 
22
- if (!newData.severity_text) return "INFO";
23
- return newData.severity_text.toUpperCase();
22
+ const text = newData.severity_text?.toLowerCase();
23
+ return ["trace", "fatal", "info", "debug", "error", "warn"].includes(text) ? text : "info";
24
24
 
25
25
  }
26
26
 
@@ -50,9 +50,30 @@ function handleLogValueWritten(logger, e) {
50
50
  },
51
51
  timestamp
52
52
  };
53
- console.log("Writing log", payload);
54
- logger.write(payload);
53
+ console.log({
54
+
55
+ "logging.googleapis.com/trace": `projects/${process.env.GCLOUD_PROJECT}/traces/${newData.trace_id}`,
56
+ "logging.googleapis.com/spanId": newData.span_id,
57
+ "severity": decideSeverity(newData),
58
+ "jsonPayload": {
59
+ ...newData,
60
+ time_server_ms,
61
+ timestamp
62
+ }
63
+
64
+ });
65
+ console.log({
66
+
67
+ "trace": `projects/${process.env.GCLOUD_PROJECT}/traces/${newData.trace_id}`,
68
+ "spanId": newData.span_id,
69
+ "severity": decideSeverity(newData).toUpperCase(),
70
+ ...newData,
71
+ time_server_ms,
72
+ timestamp
73
+
74
+ });
55
75
  after.ref.update({ time_server_ms });
76
+ // logger.write(payload);
56
77
 
57
78
  }
58
79