@rife/logger 0.0.6-beta.12 → 0.0.6-beta.14

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.
@@ -1,3 +1,2 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export * from "./trace.mjs";
@@ -1,26 +1,16 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
4
- import { dirname as __rspack_dirname } from "node:path";
5
- import * as __rspack_external_pino_std_serializers_719fa64c from "pino-std-serializers";
1
+ import "node:module";
6
2
  import path from "path";
7
3
  import pino from "pino";
8
4
  import { genTraceId, getTraceId, runInTrace } from "../trace.mjs";
9
- var __webpack_modules__ = {
5
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
6
+ import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
7
+ import { dirname as __rspack_dirname } from "node:path";
8
+ import * as __rspack_external_pino_std_serializers_719fa64c from "pino-std-serializers";
9
+ __webpack_require__.add({
10
10
  "pino-std-serializers" (module) {
11
11
  module.exports = __rspack_external_pino_std_serializers_719fa64c;
12
12
  }
13
- };
14
- var __webpack_module_cache__ = {};
15
- function __webpack_require__(moduleId) {
16
- var cachedModule = __webpack_module_cache__[moduleId];
17
- if (void 0 !== cachedModule) return cachedModule.exports;
18
- var module = __webpack_module_cache__[moduleId] = {
19
- exports: {}
20
- };
21
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
22
- return module.exports;
23
- }
13
+ });
24
14
  var pino_filename = __rspack_fileURLToPath(import.meta.url);
25
15
  var pino_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
26
16
  function getPinoConfig() {
@@ -67,6 +57,16 @@ function getPinoConfig() {
67
57
  return {
68
58
  traceId
69
59
  };
60
+ },
61
+ browser: {
62
+ write: (o)=>{
63
+ const { name, time, level, ...rest } = o;
64
+ if (name) rest.message = rest.message ? `[${name}] ${rest.message}` : `[${name}]`;
65
+ if (!rest.traceId) rest.traceId = getTraceId();
66
+ if (level >= 50) console.error(rest);
67
+ else if (level >= 40) console.warn(rest);
68
+ else console.log(rest);
69
+ }
70
70
  }
71
71
  };
72
72
  return config;
@@ -117,4 +117,4 @@ function useExpress(logger, format) {
117
117
  }, next);
118
118
  };
119
119
  }
120
- export { createLogger, useExpress };
120
+ export { createLogger, pino, useExpress };
@@ -1,21 +1,11 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
2
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
3
3
  import * as __rspack_external_rotating_file_stream_66c5ea63 from "rotating-file-stream";
4
- var __webpack_modules__ = {
4
+ __webpack_require__.add({
5
5
  "rotating-file-stream" (module) {
6
6
  module.exports = __rspack_external_rotating_file_stream_66c5ea63;
7
7
  }
8
- };
9
- var __webpack_module_cache__ = {};
10
- function __webpack_require__(moduleId) {
11
- var cachedModule = __webpack_module_cache__[moduleId];
12
- if (void 0 !== cachedModule) return cachedModule.exports;
13
- var module = __webpack_module_cache__[moduleId] = {
14
- exports: {}
15
- };
16
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
17
- return module.exports;
18
- }
8
+ });
19
9
  const generator = (time, index)=>{
20
10
  if (!time) return 'server.log';
21
11
  time = new Date(time);
@@ -37,4 +27,4 @@ const rotate = (options)=>{
37
27
  path
38
28
  });
39
29
  };
40
- export { rotate as default };
30
+ export default rotate;