@multiplatform.one/logger 6.1.0 → 6.3.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 +48 -0
- package/package.json +16 -5
- package/types/base.d.ts +21 -0
- package/types/base.d.ts.map +1 -0
- package/types/index.d.ts +9 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.tauri.d.ts +11 -0
- package/types/index.tauri.d.ts.map +1 -0
- package/types/transport/tauri.d.ts +6 -0
- package/types/transport/tauri.d.ts.map +1 -0
- package/types/transport/types.d.ts +6 -0
- package/types/transport/types.d.ts.map +1 -0
- package/types/types.d.ts +35 -0
- package/types/types.d.ts.map +1 -0
- package/CHANGELOG.md +0 -47
- package/tsconfig.json +0 -11
- package/vitest.config.mjs +0 -9
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @multiplatform.one/logger
|
|
2
|
+
|
|
3
|
+
Platform-aware logger for multiplatform.one with pluggable transports — the
|
|
4
|
+
same `logger.info(...)` call routes to the right sink on web, native, and
|
|
5
|
+
Tauri, tagged with the precise platform name.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @multiplatform.one/logger
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`@tauri-apps/api` is an optional peer (only needed on Tauri, where a
|
|
14
|
+
platform-split entry point logs through the Tauri plugin).
|
|
15
|
+
|
|
16
|
+
## What it owns
|
|
17
|
+
|
|
18
|
+
- **`logger`** — a ready-to-use singleton, pre-tagged with
|
|
19
|
+
`platform.preciseName` from `@multiplatform.one/platform`
|
|
20
|
+
- **`Logger`** — construct your own with a name or `LoggerOptions`
|
|
21
|
+
(metadata, transports)
|
|
22
|
+
- **`BaseLogger`** and the transport layer for custom sinks
|
|
23
|
+
|
|
24
|
+
## What it must not do
|
|
25
|
+
|
|
26
|
+
- No UI and no error _reporting_ policy — apps decide where warnings go
|
|
27
|
+
(Sentry wiring lives in `@multiplatform.one/core`)
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { Logger, logger } from "@multiplatform.one/logger";
|
|
33
|
+
|
|
34
|
+
// Singleton, named after the current platform
|
|
35
|
+
logger.info("app started");
|
|
36
|
+
logger.warn("cache miss", { key: "user:42" });
|
|
37
|
+
logger.error(new Error("boom"));
|
|
38
|
+
|
|
39
|
+
// Named logger for a subsystem
|
|
40
|
+
const syncLogger = new Logger("sync");
|
|
41
|
+
syncLogger.debug("subscription opened");
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Levels: `debug`, `info`, `warn`, `error`.
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/logger",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Platform-aware logger with pluggable transports for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logger",
|
|
@@ -10,16 +10,26 @@
|
|
|
10
10
|
],
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"author": "BitSpur",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://gitlab.com/bitspur/frappe/multiplatform.one.git",
|
|
16
|
+
"directory": "public/logger"
|
|
17
|
+
},
|
|
13
18
|
"source": "src/index.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"src",
|
|
21
|
+
"types",
|
|
22
|
+
"!types/.tsbuildinfo"
|
|
23
|
+
],
|
|
14
24
|
"sideEffects": false,
|
|
15
25
|
"main": "src/index.ts",
|
|
16
26
|
"module": "src/index.ts",
|
|
17
|
-
"types": "
|
|
27
|
+
"types": "types/index.d.ts",
|
|
18
28
|
"exports": {
|
|
19
29
|
"./package.json": "./package.json",
|
|
20
30
|
".": {
|
|
21
31
|
"source": "./src/index.ts",
|
|
22
|
-
"types": "./
|
|
32
|
+
"types": "./types/index.d.ts",
|
|
23
33
|
"default": "./src/index.ts"
|
|
24
34
|
}
|
|
25
35
|
},
|
|
@@ -28,7 +38,7 @@
|
|
|
28
38
|
},
|
|
29
39
|
"dependencies": {
|
|
30
40
|
"loglevel": "^1.9.2",
|
|
31
|
-
"@multiplatform.one/platform": "6.
|
|
41
|
+
"@multiplatform.one/platform": "6.3.0"
|
|
32
42
|
},
|
|
33
43
|
"devDependencies": {
|
|
34
44
|
"typescript": "~5.9.3"
|
|
@@ -42,6 +52,7 @@
|
|
|
42
52
|
}
|
|
43
53
|
},
|
|
44
54
|
"scripts": {
|
|
45
|
-
"typecheck": "tsc --noEmit"
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"build": "rm -rf types 2>/dev/null && tsc -p tsconfig.build.json"
|
|
46
57
|
}
|
|
47
58
|
}
|
package/types/base.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import log from "loglevel";
|
|
2
|
+
import type { LogTransport } from "./transport/types";
|
|
3
|
+
import type { LoggerMetadata, LoggerOptions } from "./types";
|
|
4
|
+
export declare const defaultLoggerConfig: Omit<LoggerOptions, "metadata">;
|
|
5
|
+
export declare abstract class BaseLogger {
|
|
6
|
+
protected transport?: LogTransport;
|
|
7
|
+
protected metadata: LoggerMetadata;
|
|
8
|
+
protected logger: log.Logger;
|
|
9
|
+
protected name: string;
|
|
10
|
+
constructor(config?: LoggerOptions | string);
|
|
11
|
+
protected createTransport?(): LogTransport | undefined;
|
|
12
|
+
trace(...args: unknown[]): void;
|
|
13
|
+
debug(...args: unknown[]): void;
|
|
14
|
+
info(...args: unknown[]): void;
|
|
15
|
+
warn(...args: unknown[]): void;
|
|
16
|
+
error(...args: unknown[]): void;
|
|
17
|
+
log(...args: unknown[]): void;
|
|
18
|
+
private sendToTransport;
|
|
19
|
+
getSubLogger(input: LoggerOptions | string): BaseLogger;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7D,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAItD,CAAC;AAEX,8BAAsB,UAAU;IAC9B,SAAS,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC;IACnC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC;IACnC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;IAC7B,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEX,MAAM,GAAE,aAAa,GAAG,MAAW;IAU/C,SAAS,CAAC,eAAe,CAAC,IAAI,YAAY,GAAG,SAAS;IAE/C,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAK/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAK/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAK9B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAK9B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAK/B,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAKpC,OAAO,CAAC,eAAe;IAYhB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,UAAU;CAc/D"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseLogger } from "./base";
|
|
2
|
+
import type { LoggerOptions } from "./types";
|
|
3
|
+
export declare class Logger extends BaseLogger {
|
|
4
|
+
constructor(config?: LoggerOptions | string);
|
|
5
|
+
}
|
|
6
|
+
export declare const logger: Logger;
|
|
7
|
+
export * from "./types";
|
|
8
|
+
export * from "./base";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,MAAO,SAAQ,UAAU;gBACxB,MAAM,GAAE,aAAa,GAAG,MAAW;CAUhD;AAED,eAAO,MAAM,MAAM,QAAe,CAAC;AAEnC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseLogger } from "./base";
|
|
2
|
+
import type { LogTransport } from "./transport/types";
|
|
3
|
+
import type { LoggerOptions } from "./types";
|
|
4
|
+
export declare class Logger extends BaseLogger {
|
|
5
|
+
constructor(config?: LoggerOptions | string);
|
|
6
|
+
protected createTransport(): LogTransport | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare const logger: Logger;
|
|
9
|
+
export * from "./types";
|
|
10
|
+
export * from "./base";
|
|
11
|
+
//# sourceMappingURL=index.tauri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.tauri.d.ts","sourceRoot":"","sources":["../src/index.tauri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,MAAO,SAAQ,UAAU;gBACxB,MAAM,GAAE,aAAa,GAAG,MAAW;IAW/C,SAAS,CAAC,eAAe,IAAI,YAAY,GAAG,SAAS;CAGtD;AAED,eAAO,MAAM,MAAM,QAAe,CAAC;AAEnC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tauri.d.ts","sourceRoot":"","sources":["../../src/transport/tauri.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAa5C,qBAAa,cAAe,YAAW,YAAY;IACjD,IAAI,CAAC,OAAO,EAAE,UAAU;CAiBzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/transport/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB"}
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LogLevelDesc } from "loglevel";
|
|
2
|
+
import type { PlatformName } from "@multiplatform.one/platform";
|
|
3
|
+
export interface ILogObj {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare enum LogLevel {
|
|
7
|
+
Trace = 0,
|
|
8
|
+
Debug = 1,
|
|
9
|
+
Info = 2,
|
|
10
|
+
Warn = 3,
|
|
11
|
+
Error = 4,
|
|
12
|
+
Silent = 5
|
|
13
|
+
}
|
|
14
|
+
export declare enum LogSource {
|
|
15
|
+
Main = "main",
|
|
16
|
+
Renderer = "renderer",
|
|
17
|
+
Default = "default"
|
|
18
|
+
}
|
|
19
|
+
export interface LogPayload {
|
|
20
|
+
args?: unknown[];
|
|
21
|
+
level: LogLevel;
|
|
22
|
+
message: unknown;
|
|
23
|
+
platform: PlatformName;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
}
|
|
26
|
+
export interface LoggerMetadata {
|
|
27
|
+
platform?: PlatformName;
|
|
28
|
+
}
|
|
29
|
+
export interface LoggerOptions {
|
|
30
|
+
metadata?: LoggerMetadata;
|
|
31
|
+
name?: string;
|
|
32
|
+
type?: "pretty" | "json";
|
|
33
|
+
level?: LogLevelDesc;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;IACT,MAAM,IAAI;CACX;AAED,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB"}
|
package/CHANGELOG.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# @multiplatform.one/logger
|
|
2
|
-
|
|
3
|
-
## 6.1.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- @multiplatform.one/platform@6.1.0
|
|
8
|
-
|
|
9
|
-
## 6.0.4
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- @multiplatform.one/platform@6.0.4
|
|
14
|
-
|
|
15
|
-
## 6.0.3
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- @multiplatform.one/platform@6.0.3
|
|
20
|
-
|
|
21
|
-
## 6.0.2
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- @multiplatform.one/platform@6.0.2
|
|
26
|
-
|
|
27
|
-
## 6.0.1
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- @multiplatform.one/platform@6.0.1
|
|
32
|
-
|
|
33
|
-
## 6.0.0
|
|
34
|
-
|
|
35
|
-
### Major Changes
|
|
36
|
-
|
|
37
|
-
- Unified 6.0.0 release: realign all public `@multiplatform.one/*` packages onto a single, matching version line (changesets `fixed` group). Highlights:
|
|
38
|
-
- **web3 split** into standalone `@multiplatform.one/connectkit` and `@multiplatform.one/gpg` packages; `web3` now depends on them instead of bundling ConnectKit.
|
|
39
|
-
- **Sign-In With GPG** screen added to the ConnectKit modal.
|
|
40
|
-
- **Native workspace web-resolution fix** + platform-split wrappers (rich-text / `TextEditor`, forms `Barcode`) so web-only libraries stay out of the native Hermes bundle.
|
|
41
|
-
|
|
42
|
-
From this release on, these packages are versioned together.
|
|
43
|
-
|
|
44
|
-
### Patch Changes
|
|
45
|
-
|
|
46
|
-
- Updated dependencies
|
|
47
|
-
- @multiplatform.one/platform@6.0.0
|
package/tsconfig.json
DELETED