@loglayer/transport-tslog 1.0.1
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/LICENSE +21 -0
- package/README.md +33 -0
- package/dist/index.cjs +34 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Theo Gravity
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# tslog Transport for LogLayer
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@loglayer/transport-tslog)
|
|
4
|
+
[](https://www.npmjs.com/package/@loglayer/transport-tslog)
|
|
5
|
+
[](http://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
[tslog](https://tslog.js.org/) provides powerful, fast and expressive logging for TypeScript and JavaScript.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install loglayer @loglayer/transport-tslog tslog
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { LogLayer } from 'loglayer'
|
|
19
|
+
import { TracerTransport } from '@loglayer/transport-tslog'
|
|
20
|
+
import { Logger, ILogObj } from "tslog";
|
|
21
|
+
|
|
22
|
+
const tslog: Logger<ILogObj> = new Logger();
|
|
23
|
+
|
|
24
|
+
const log = new LogLayer({
|
|
25
|
+
transport: new TsLogTransport({
|
|
26
|
+
logger: tslog,
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
For more details, visit [https://loglayer.dev/transports/tslog](https://loglayer.dev/transports/tslog)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/TsLogTransport.ts
|
|
2
|
+
var _transport = require('@loglayer/transport');
|
|
3
|
+
var TsLogTransport = class extends _transport.BaseTransport {
|
|
4
|
+
shipToLogger({ logLevel, messages, data, hasData }) {
|
|
5
|
+
if (data && hasData) {
|
|
6
|
+
messages.push(data);
|
|
7
|
+
}
|
|
8
|
+
switch (logLevel) {
|
|
9
|
+
case _transport.LogLevel.info:
|
|
10
|
+
this.logger.info(...messages);
|
|
11
|
+
break;
|
|
12
|
+
case _transport.LogLevel.warn:
|
|
13
|
+
this.logger.warn(...messages);
|
|
14
|
+
break;
|
|
15
|
+
case _transport.LogLevel.error:
|
|
16
|
+
this.logger.error(...messages);
|
|
17
|
+
break;
|
|
18
|
+
case _transport.LogLevel.trace:
|
|
19
|
+
this.logger.trace(...messages);
|
|
20
|
+
break;
|
|
21
|
+
case _transport.LogLevel.debug:
|
|
22
|
+
this.logger.debug(...messages);
|
|
23
|
+
break;
|
|
24
|
+
case _transport.LogLevel.fatal:
|
|
25
|
+
this.logger.fatal(...messages);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
return messages;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
exports.TsLogTransport = TsLogTransport;
|
|
34
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/loglayer/loglayer/packages/transports/tslog/dist/index.cjs","../src/TsLogTransport.ts"],"names":[],"mappings":"AAAA;ACAA,gDAAsE;AAG/D,IAAM,eAAA,EAAN,MAAA,QAA6B,yBAA2B;AAAA,EAC7D,YAAA,CAAa,EAAE,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,QAAQ,CAAA,EAA4B;AAC3E,IAAA,GAAA,CAAI,KAAA,GAAQ,OAAA,EAAS;AAEnB,MAAA,QAAA,CAAS,IAAA,CAAK,IAAI,CAAA;AAAA,IACpB;AAEA,IAAA,OAAA,CAAQ,QAAA,EAAU;AAAA,MAChB,KAAK,mBAAA,CAAS,IAAA;AACZ,QAAA,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,GAAG,QAAQ,CAAA;AAC5B,QAAA,KAAA;AAAA,MACF,KAAK,mBAAA,CAAS,IAAA;AACZ,QAAA,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,GAAG,QAAQ,CAAA;AAC5B,QAAA,KAAA;AAAA,MACF,KAAK,mBAAA,CAAS,KAAA;AACZ,QAAA,IAAA,CAAK,MAAA,CAAO,KAAA,CAAM,GAAG,QAAQ,CAAA;AAC7B,QAAA,KAAA;AAAA,MACF,KAAK,mBAAA,CAAS,KAAA;AACZ,QAAA,IAAA,CAAK,MAAA,CAAO,KAAA,CAAM,GAAG,QAAQ,CAAA;AAC7B,QAAA,KAAA;AAAA,MACF,KAAK,mBAAA,CAAS,KAAA;AACZ,QAAA,IAAA,CAAK,MAAA,CAAO,KAAA,CAAM,GAAG,QAAQ,CAAA;AAC7B,QAAA,KAAA;AAAA,MACF,KAAK,mBAAA,CAAS,KAAA;AACZ,QAAA,IAAA,CAAK,MAAA,CAAO,KAAA,CAAM,GAAG,QAAQ,CAAA;AAC7B,QAAA,KAAA;AAAA,IACJ;AAEA,IAAA,OAAO,QAAA;AAAA,EACT;AACF,CAAA;ADHA;AACE;AACF,wCAAC","file":"/home/runner/work/loglayer/loglayer/packages/transports/tslog/dist/index.cjs","sourcesContent":[null,"import { BaseTransport, type LogLayerTransportParams, LogLevel } from \"@loglayer/transport\";\nimport type { Logger } from \"tslog\";\n\nexport class TsLogTransport extends BaseTransport<Logger<any>> {\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams) {\n if (data && hasData) {\n // library wants the data object to be the last parameter\n messages.push(data);\n }\n\n switch (logLevel) {\n case LogLevel.info:\n this.logger.info(...messages);\n break;\n case LogLevel.warn:\n this.logger.warn(...messages);\n break;\n case LogLevel.error:\n this.logger.error(...messages);\n break;\n case LogLevel.trace:\n this.logger.trace(...messages);\n break;\n case LogLevel.debug:\n this.logger.debug(...messages);\n break;\n case LogLevel.fatal:\n this.logger.fatal(...messages);\n break;\n }\n\n return messages;\n }\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseTransport, LogLayerTransportParams } from '@loglayer/transport';
|
|
2
|
+
import { Logger } from 'tslog';
|
|
3
|
+
|
|
4
|
+
declare class TsLogTransport extends BaseTransport<Logger<any>> {
|
|
5
|
+
shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams): any[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { TsLogTransport };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseTransport, LogLayerTransportParams } from '@loglayer/transport';
|
|
2
|
+
import { Logger } from 'tslog';
|
|
3
|
+
|
|
4
|
+
declare class TsLogTransport extends BaseTransport<Logger<any>> {
|
|
5
|
+
shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams): any[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { TsLogTransport };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/TsLogTransport.ts
|
|
2
|
+
import { BaseTransport, LogLevel } from "@loglayer/transport";
|
|
3
|
+
var TsLogTransport = class extends BaseTransport {
|
|
4
|
+
shipToLogger({ logLevel, messages, data, hasData }) {
|
|
5
|
+
if (data && hasData) {
|
|
6
|
+
messages.push(data);
|
|
7
|
+
}
|
|
8
|
+
switch (logLevel) {
|
|
9
|
+
case LogLevel.info:
|
|
10
|
+
this.logger.info(...messages);
|
|
11
|
+
break;
|
|
12
|
+
case LogLevel.warn:
|
|
13
|
+
this.logger.warn(...messages);
|
|
14
|
+
break;
|
|
15
|
+
case LogLevel.error:
|
|
16
|
+
this.logger.error(...messages);
|
|
17
|
+
break;
|
|
18
|
+
case LogLevel.trace:
|
|
19
|
+
this.logger.trace(...messages);
|
|
20
|
+
break;
|
|
21
|
+
case LogLevel.debug:
|
|
22
|
+
this.logger.debug(...messages);
|
|
23
|
+
break;
|
|
24
|
+
case LogLevel.fatal:
|
|
25
|
+
this.logger.fatal(...messages);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
return messages;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
TsLogTransport
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/TsLogTransport.ts"],"sourcesContent":["import { BaseTransport, type LogLayerTransportParams, LogLevel } from \"@loglayer/transport\";\nimport type { Logger } from \"tslog\";\n\nexport class TsLogTransport extends BaseTransport<Logger<any>> {\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams) {\n if (data && hasData) {\n // library wants the data object to be the last parameter\n messages.push(data);\n }\n\n switch (logLevel) {\n case LogLevel.info:\n this.logger.info(...messages);\n break;\n case LogLevel.warn:\n this.logger.warn(...messages);\n break;\n case LogLevel.error:\n this.logger.error(...messages);\n break;\n case LogLevel.trace:\n this.logger.trace(...messages);\n break;\n case LogLevel.debug:\n this.logger.debug(...messages);\n break;\n case LogLevel.fatal:\n this.logger.fatal(...messages);\n break;\n }\n\n return messages;\n }\n}\n"],"mappings":";AAAA,SAAS,eAA6C,gBAAgB;AAG/D,IAAM,iBAAN,cAA6B,cAA2B;AAAA,EAC7D,aAAa,EAAE,UAAU,UAAU,MAAM,QAAQ,GAA4B;AAC3E,QAAI,QAAQ,SAAS;AAEnB,eAAS,KAAK,IAAI;AAAA,IACpB;AAEA,YAAQ,UAAU;AAAA,MAChB,KAAK,SAAS;AACZ,aAAK,OAAO,KAAK,GAAG,QAAQ;AAC5B;AAAA,MACF,KAAK,SAAS;AACZ,aAAK,OAAO,KAAK,GAAG,QAAQ;AAC5B;AAAA,MACF,KAAK,SAAS;AACZ,aAAK,OAAO,MAAM,GAAG,QAAQ;AAC7B;AAAA,MACF,KAAK,SAAS;AACZ,aAAK,OAAO,MAAM,GAAG,QAAQ;AAC7B;AAAA,MACF,KAAK,SAAS;AACZ,aAAK,OAAO,MAAM,GAAG,QAAQ;AAC7B;AAAA,MACF,KAAK,SAAS;AACZ,aAAK,OAAO,MAAM,GAAG,QAAQ;AAC7B;AAAA,IACJ;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loglayer/transport-tslog",
|
|
3
|
+
"description": "tslog transport for loglayer.",
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"import": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"require": {
|
|
14
|
+
"types": "./dist/index.d.cts",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": "loglayer/loglayer.git",
|
|
21
|
+
"author": "Theo Gravity <theo@suteki.nu>",
|
|
22
|
+
"keywords": [
|
|
23
|
+
"logging",
|
|
24
|
+
"log",
|
|
25
|
+
"loglayer",
|
|
26
|
+
"tslog",
|
|
27
|
+
"transport"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@loglayer/transport": "1.1.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"hash-runner": "2.0.1",
|
|
34
|
+
"@types/node": "22.10.4",
|
|
35
|
+
"tsup": "8.3.5",
|
|
36
|
+
"tsx": "4.19.2",
|
|
37
|
+
"typescript": "5.7.2",
|
|
38
|
+
"vitest": "2.1.8",
|
|
39
|
+
"loglayer": "5.0.5",
|
|
40
|
+
"@internal/tsconfig": "1.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"tslog": "*"
|
|
44
|
+
},
|
|
45
|
+
"bugs": "https://github.com/loglayer/loglayer/issues",
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18"
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist"
|
|
51
|
+
],
|
|
52
|
+
"homepage": "https://loglayer.dev",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsup src/index.ts",
|
|
55
|
+
"test": "vitest --run",
|
|
56
|
+
"build:dev": "hash-runner",
|
|
57
|
+
"clean": "rm -rf .turbo node_modules dist",
|
|
58
|
+
"lint": "biome check --write --unsafe src && biome format src --write && biome lint src --fix",
|
|
59
|
+
"verify-types": "tsc --noEmit",
|
|
60
|
+
"livetest": "tsx src/__tests__/livetest.ts"
|
|
61
|
+
}
|
|
62
|
+
}
|