@bsb/observable-logging-file 9.0.0 → 9.1.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/README.md +49 -20
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -17
- package/lib/plugins/observable-logging-file/index.d.ts +68 -80
- package/lib/plugins/observable-logging-file/index.js +34 -77
- package/lib/schemas/observable-logging-file.json +0 -113
- package/lib/schemas/observable-logging-file.plugin.json +1 -114
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# @bsb/observable-logging-file
|
|
2
2
|
|
|
3
|
-
File logging observable plugin for BSB
|
|
3
|
+
File logging observable plugin for BSB with automatic rotation, compression, and retention management.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- Rotating file streams with size and time-based rotation
|
|
8
|
+
- Automatic gzip compression of rotated log files
|
|
9
|
+
- Retention management to delete old log files
|
|
10
|
+
- Flexible formatting with JSON or plain text output
|
|
11
|
+
- Date-based filenames with customizable patterns
|
|
12
|
+
- Level filtering for log output control
|
|
4
13
|
|
|
5
14
|
## Installation
|
|
6
15
|
|
|
@@ -8,18 +17,9 @@ File logging observable plugin for BSB (Better-Service-Base) with automatic rota
|
|
|
8
17
|
npm install @bsb/observable-logging-file
|
|
9
18
|
```
|
|
10
19
|
|
|
11
|
-
## Features
|
|
12
|
-
|
|
13
|
-
- **Rotating file streams** - Automatic rotation based on file size or time intervals
|
|
14
|
-
- **Compression** - Gzip compression of rotated log files
|
|
15
|
-
- **Retention management** - Automatically delete old log files
|
|
16
|
-
- **Flexible formatting** - JSON or plain text output with customizable timestamps
|
|
17
|
-
- **Date-based filenames** - Support for date patterns in filenames
|
|
18
|
-
- **Level filtering** - Control which log levels are written to files
|
|
19
|
-
|
|
20
20
|
## Configuration
|
|
21
21
|
|
|
22
|
-
Add the plugin to your BSB configuration:
|
|
22
|
+
Add the plugin to your BSB configuration file:
|
|
23
23
|
|
|
24
24
|
```yaml
|
|
25
25
|
plugins:
|
|
@@ -48,15 +48,44 @@ plugins:
|
|
|
48
48
|
|
|
49
49
|
### Configuration Options
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
|
|
51
|
+
| Option | Description | Default |
|
|
52
|
+
|--------|-------------|---------|
|
|
53
|
+
| `directory` | Base directory for log files | `./logs` |
|
|
54
|
+
| `filename` | Filename pattern (use `%DATE%` for date substitution) | `application.log` |
|
|
55
|
+
| `dateFormat` | Date format for filename | `YYYY-MM-DD` |
|
|
56
|
+
| `rotation.maxSize` | Maximum file size before rotation | `10M` |
|
|
57
|
+
| `rotation.maxFiles` | Number of old log files to keep | `7` |
|
|
58
|
+
| `rotation.interval` | Time-based rotation: `daily`, `hourly`, `none` | `daily` |
|
|
59
|
+
| `rotation.compress` | Gzip rotated files | `true` |
|
|
60
|
+
| `levels` | Enable or disable specific log levels | All enabled |
|
|
61
|
+
| `format` | Timestamp, trace info, and pretty print options | - |
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
Once configured, logs are automatically written to files:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
this.log.info("Service initialized");
|
|
69
|
+
this.log.debug("Debug information", { details: "..." });
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Log Rotation Example
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
logs/
|
|
76
|
+
application-2026-02-04.log
|
|
77
|
+
application-2026-02-03.log.gz
|
|
78
|
+
application-2026-02-02.log.gz
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
Detailed documentation (used by the BSB Registry): `https://github.com/BetterCorp/better-service-base/blob/master/plugins/nodejs/observable-logging-file/docs/plugin.md`
|
|
84
|
+
|
|
85
|
+
## Links
|
|
86
|
+
|
|
87
|
+
- GitHub: `https://github.com/BetterCorp/better-service-base/tree/master/plugins/nodejs/observable-logging-file`
|
|
88
|
+
- BSB Registry (package): `https://io.bsbcode.dev/packages/nodejs/@bsb/observable-logging-file`
|
|
60
89
|
|
|
61
90
|
## License
|
|
62
91
|
|
package/lib/index.d.ts
CHANGED
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
* You should have received a copy of the GNU Affero General Public License
|
|
25
25
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
26
26
|
*/
|
|
27
|
-
export * from "./plugins/observable-logging-file";
|
|
27
|
+
export * from "./plugins/observable-logging-file/index.js";
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* BSB (Better-Service-Base) is an event-bus based microservice framework.
|
|
4
3
|
* Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd
|
|
@@ -25,19 +24,4 @@
|
|
|
25
24
|
* You should have received a copy of the GNU Affero General Public License
|
|
26
25
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
27
26
|
*/
|
|
28
|
-
|
|
29
|
-
if (k2 === undefined) k2 = k;
|
|
30
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
-
}
|
|
34
|
-
Object.defineProperty(o, k2, desc);
|
|
35
|
-
}) : (function(o, m, k, k2) {
|
|
36
|
-
if (k2 === undefined) k2 = k;
|
|
37
|
-
o[k2] = m[k];
|
|
38
|
-
}));
|
|
39
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
40
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
41
|
-
};
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
__exportStar(require("./plugins/observable-logging-file"), exports);
|
|
27
|
+
export * from "./plugins/observable-logging-file/index.js";
|
|
@@ -26,93 +26,81 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { BSBObservable, BSBObservableConstructor, BSBError } from "@bsb/base";
|
|
28
28
|
import { DTrace, LogMeta } from "@bsb/base";
|
|
29
|
-
import
|
|
29
|
+
import * as av from "@anyvali/js";
|
|
30
30
|
/**
|
|
31
31
|
* Configuration schema for file logging plugin
|
|
32
32
|
*/
|
|
33
|
-
export declare const FileLoggingConfigSchema:
|
|
34
|
-
directory:
|
|
35
|
-
filename:
|
|
36
|
-
dateFormat:
|
|
37
|
-
rotation:
|
|
38
|
-
maxSize:
|
|
39
|
-
maxFiles:
|
|
40
|
-
interval:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
error: z.ZodDefault<z.ZodBoolean>;
|
|
79
|
-
}, z.core.$strip>;
|
|
80
|
-
format: z.ZodObject<{
|
|
81
|
-
timestamp: z.ZodDefault<z.ZodBoolean>;
|
|
82
|
-
traceInfo: z.ZodDefault<z.ZodBoolean>;
|
|
83
|
-
prettyPrint: z.ZodDefault<z.ZodBoolean>;
|
|
84
|
-
}, z.core.$strip>;
|
|
85
|
-
}, z.core.$strip>>;
|
|
33
|
+
export declare const FileLoggingConfigSchema: av.ObjectSchema<{
|
|
34
|
+
directory: av.OptionalSchema<av.StringSchema>;
|
|
35
|
+
filename: av.OptionalSchema<av.StringSchema>;
|
|
36
|
+
dateFormat: av.OptionalSchema<av.StringSchema>;
|
|
37
|
+
rotation: av.ObjectSchema<{
|
|
38
|
+
maxSize: av.OptionalSchema<av.StringSchema>;
|
|
39
|
+
maxFiles: av.OptionalSchema<av.Int32Schema>;
|
|
40
|
+
interval: av.OptionalSchema<av.EnumSchema<string[]>>;
|
|
41
|
+
compress: av.OptionalSchema<av.BoolSchema>;
|
|
42
|
+
}>;
|
|
43
|
+
levels: av.ObjectSchema<{
|
|
44
|
+
debug: av.OptionalSchema<av.BoolSchema>;
|
|
45
|
+
info: av.OptionalSchema<av.BoolSchema>;
|
|
46
|
+
warn: av.OptionalSchema<av.BoolSchema>;
|
|
47
|
+
error: av.OptionalSchema<av.BoolSchema>;
|
|
48
|
+
}>;
|
|
49
|
+
format: av.ObjectSchema<{
|
|
50
|
+
timestamp: av.OptionalSchema<av.BoolSchema>;
|
|
51
|
+
traceInfo: av.OptionalSchema<av.BoolSchema>;
|
|
52
|
+
prettyPrint: av.OptionalSchema<av.BoolSchema>;
|
|
53
|
+
}>;
|
|
54
|
+
}>;
|
|
55
|
+
export type FileLoggingConfig = av.Infer<typeof FileLoggingConfigSchema>;
|
|
56
|
+
export declare const Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
|
|
57
|
+
directory: av.OptionalSchema<av.StringSchema>;
|
|
58
|
+
filename: av.OptionalSchema<av.StringSchema>;
|
|
59
|
+
dateFormat: av.OptionalSchema<av.StringSchema>;
|
|
60
|
+
rotation: av.ObjectSchema<{
|
|
61
|
+
maxSize: av.OptionalSchema<av.StringSchema>;
|
|
62
|
+
maxFiles: av.OptionalSchema<av.Int32Schema>;
|
|
63
|
+
interval: av.OptionalSchema<av.EnumSchema<string[]>>;
|
|
64
|
+
compress: av.OptionalSchema<av.BoolSchema>;
|
|
65
|
+
}>;
|
|
66
|
+
levels: av.ObjectSchema<{
|
|
67
|
+
debug: av.OptionalSchema<av.BoolSchema>;
|
|
68
|
+
info: av.OptionalSchema<av.BoolSchema>;
|
|
69
|
+
warn: av.OptionalSchema<av.BoolSchema>;
|
|
70
|
+
error: av.OptionalSchema<av.BoolSchema>;
|
|
71
|
+
}>;
|
|
72
|
+
format: av.ObjectSchema<{
|
|
73
|
+
timestamp: av.OptionalSchema<av.BoolSchema>;
|
|
74
|
+
traceInfo: av.OptionalSchema<av.BoolSchema>;
|
|
75
|
+
prettyPrint: av.OptionalSchema<av.BoolSchema>;
|
|
76
|
+
}>;
|
|
77
|
+
}>>;
|
|
86
78
|
/**
|
|
87
79
|
* File logging observable plugin with rotation and compression
|
|
88
80
|
*/
|
|
89
81
|
export declare class Plugin extends BSBObservable<InstanceType<typeof Config>> {
|
|
90
|
-
static Config: import("@bsb/base").BSBPluginConfigClass<
|
|
91
|
-
directory:
|
|
92
|
-
filename:
|
|
93
|
-
dateFormat:
|
|
94
|
-
rotation:
|
|
95
|
-
maxSize:
|
|
96
|
-
maxFiles:
|
|
97
|
-
interval:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
traceInfo: z.ZodDefault<z.ZodBoolean>;
|
|
113
|
-
prettyPrint: z.ZodDefault<z.ZodBoolean>;
|
|
114
|
-
}, z.core.$strip>;
|
|
115
|
-
}, z.core.$strip>>;
|
|
82
|
+
static Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
|
|
83
|
+
directory: av.OptionalSchema<av.StringSchema>;
|
|
84
|
+
filename: av.OptionalSchema<av.StringSchema>;
|
|
85
|
+
dateFormat: av.OptionalSchema<av.StringSchema>;
|
|
86
|
+
rotation: av.ObjectSchema<{
|
|
87
|
+
maxSize: av.OptionalSchema<av.StringSchema>;
|
|
88
|
+
maxFiles: av.OptionalSchema<av.Int32Schema>;
|
|
89
|
+
interval: av.OptionalSchema<av.EnumSchema<string[]>>;
|
|
90
|
+
compress: av.OptionalSchema<av.BoolSchema>;
|
|
91
|
+
}>;
|
|
92
|
+
levels: av.ObjectSchema<{
|
|
93
|
+
debug: av.OptionalSchema<av.BoolSchema>;
|
|
94
|
+
info: av.OptionalSchema<av.BoolSchema>;
|
|
95
|
+
warn: av.OptionalSchema<av.BoolSchema>;
|
|
96
|
+
error: av.OptionalSchema<av.BoolSchema>;
|
|
97
|
+
}>;
|
|
98
|
+
format: av.ObjectSchema<{
|
|
99
|
+
timestamp: av.OptionalSchema<av.BoolSchema>;
|
|
100
|
+
traceInfo: av.OptionalSchema<av.BoolSchema>;
|
|
101
|
+
prettyPrint: av.OptionalSchema<av.BoolSchema>;
|
|
102
|
+
}>;
|
|
103
|
+
}>>;
|
|
116
104
|
private logFormatter;
|
|
117
105
|
private logStream;
|
|
118
106
|
private isDisposed;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* BSB (Better-Service-Base) is an event-bus based microservice framework.
|
|
4
3
|
* Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd
|
|
@@ -25,85 +24,44 @@
|
|
|
25
24
|
* You should have received a copy of the GNU Affero General Public License
|
|
26
25
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
27
26
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
Object.defineProperty(o, k2, desc);
|
|
35
|
-
}) : (function(o, m, k, k2) {
|
|
36
|
-
if (k2 === undefined) k2 = k;
|
|
37
|
-
o[k2] = m[k];
|
|
38
|
-
}));
|
|
39
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
40
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
41
|
-
}) : function(o, v) {
|
|
42
|
-
o["default"] = v;
|
|
43
|
-
});
|
|
44
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
-
var ownKeys = function(o) {
|
|
46
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
-
var ar = [];
|
|
48
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
-
return ar;
|
|
50
|
-
};
|
|
51
|
-
return ownKeys(o);
|
|
52
|
-
};
|
|
53
|
-
return function (mod) {
|
|
54
|
-
if (mod && mod.__esModule) return mod;
|
|
55
|
-
var result = {};
|
|
56
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
-
__setModuleDefault(result, mod);
|
|
58
|
-
return result;
|
|
59
|
-
};
|
|
60
|
-
})();
|
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.Plugin = exports.Config = exports.FileLoggingConfigSchema = void 0;
|
|
63
|
-
const base_1 = require("@bsb/base");
|
|
64
|
-
const rotating_file_stream_1 = require("rotating-file-stream");
|
|
65
|
-
const zod_1 = require("zod");
|
|
66
|
-
const fs = __importStar(require("fs"));
|
|
67
|
-
const path = __importStar(require("path"));
|
|
27
|
+
import { BSBObservable, createConfigSchema, LogFormatter, BSBError } from "@bsb/base";
|
|
28
|
+
import { createStream } from "rotating-file-stream";
|
|
29
|
+
import * as av from "@anyvali/js";
|
|
30
|
+
import * as fs from "fs";
|
|
31
|
+
import * as path from "path";
|
|
68
32
|
/**
|
|
69
33
|
* Configuration schema for file logging plugin
|
|
70
34
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
timestamp: zod_1.z.boolean().default(true),
|
|
95
|
-
traceInfo: zod_1.z.boolean().default(true),
|
|
96
|
-
prettyPrint: zod_1.z.boolean().default(false), // JSON or text
|
|
97
|
-
}),
|
|
98
|
-
});
|
|
99
|
-
exports.Config = (0, base_1.createConfigSchema)({
|
|
35
|
+
export const FileLoggingConfigSchema = av.object({
|
|
36
|
+
directory: av.optional(av.string()).default("./logs"),
|
|
37
|
+
filename: av.optional(av.string()).default("application-%DATE%.log"),
|
|
38
|
+
dateFormat: av.optional(av.string()).default("YYYY-MM-DD"),
|
|
39
|
+
rotation: av.object({
|
|
40
|
+
maxSize: av.optional(av.string()).default("10M"),
|
|
41
|
+
maxFiles: av.optional(av.int32().min(0)).default(7),
|
|
42
|
+
interval: av.optional(av.enum_(["daily", "hourly", "none"])).default("daily"),
|
|
43
|
+
compress: av.optional(av.bool()).default(true),
|
|
44
|
+
}, { unknownKeys: "strip" }),
|
|
45
|
+
levels: av.object({
|
|
46
|
+
debug: av.optional(av.bool()).default(true),
|
|
47
|
+
info: av.optional(av.bool()).default(true),
|
|
48
|
+
warn: av.optional(av.bool()).default(true),
|
|
49
|
+
error: av.optional(av.bool()).default(true),
|
|
50
|
+
}, { unknownKeys: "strip" }),
|
|
51
|
+
format: av.object({
|
|
52
|
+
timestamp: av.optional(av.bool()).default(true),
|
|
53
|
+
traceInfo: av.optional(av.bool()).default(true),
|
|
54
|
+
prettyPrint: av.optional(av.bool()).default(false),
|
|
55
|
+
}, { unknownKeys: "strip" }),
|
|
56
|
+
}, { unknownKeys: "strip" });
|
|
57
|
+
export const Config = createConfigSchema({
|
|
100
58
|
name: 'observable-logging-file',
|
|
101
59
|
description: 'File-based observable logging with rotation and retention controls',
|
|
102
60
|
version: '9.0.0',
|
|
103
61
|
image: './observable-logging-file.png',
|
|
104
62
|
tags: ['logging', 'file', 'rotation', 'observability'],
|
|
105
63
|
documentation: ['./docs/plugin.md'],
|
|
106
|
-
},
|
|
64
|
+
}, FileLoggingConfigSchema);
|
|
107
65
|
/**
|
|
108
66
|
* Parse size string to bytes (e.g., "10M", "100K", "1G")
|
|
109
67
|
*/
|
|
@@ -117,9 +75,9 @@ function parseSize(size) {
|
|
|
117
75
|
/**
|
|
118
76
|
* File logging observable plugin with rotation and compression
|
|
119
77
|
*/
|
|
120
|
-
class Plugin extends
|
|
121
|
-
static Config =
|
|
122
|
-
logFormatter = new
|
|
78
|
+
export class Plugin extends BSBObservable {
|
|
79
|
+
static Config = Config;
|
|
80
|
+
logFormatter = new LogFormatter();
|
|
123
81
|
logStream = null;
|
|
124
82
|
isDisposed = false;
|
|
125
83
|
constructor(config) {
|
|
@@ -153,7 +111,7 @@ class Plugin extends base_1.BSBObservable {
|
|
|
153
111
|
rotateOptions.maxFiles = this.config.rotation.maxFiles;
|
|
154
112
|
}
|
|
155
113
|
// Create rotating file stream
|
|
156
|
-
this.logStream =
|
|
114
|
+
this.logStream = createStream(filename, {
|
|
157
115
|
...rotateOptions,
|
|
158
116
|
path: logDir,
|
|
159
117
|
});
|
|
@@ -240,7 +198,7 @@ class Plugin extends base_1.BSBObservable {
|
|
|
240
198
|
if (!this.config.levels.error) {
|
|
241
199
|
return;
|
|
242
200
|
}
|
|
243
|
-
if (message instanceof
|
|
201
|
+
if (message instanceof BSBError) {
|
|
244
202
|
if (message.raw !== null) {
|
|
245
203
|
this.writeLog("error", message.raw.trace, pluginName, message.raw.message, message.raw.meta);
|
|
246
204
|
}
|
|
@@ -260,4 +218,3 @@ class Plugin extends base_1.BSBObservable {
|
|
|
260
218
|
}
|
|
261
219
|
}
|
|
262
220
|
}
|
|
263
|
-
exports.Plugin = Plugin;
|
|
@@ -2,119 +2,6 @@
|
|
|
2
2
|
"pluginName": "observable-logging-file",
|
|
3
3
|
"version": "9.0.0",
|
|
4
4
|
"events": {},
|
|
5
|
-
"configSchema": {
|
|
6
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"directory": {
|
|
10
|
-
"default": "./logs",
|
|
11
|
-
"type": "string"
|
|
12
|
-
},
|
|
13
|
-
"filename": {
|
|
14
|
-
"default": "application-%DATE%.log",
|
|
15
|
-
"type": "string"
|
|
16
|
-
},
|
|
17
|
-
"dateFormat": {
|
|
18
|
-
"default": "YYYY-MM-DD",
|
|
19
|
-
"type": "string"
|
|
20
|
-
},
|
|
21
|
-
"rotation": {
|
|
22
|
-
"type": "object",
|
|
23
|
-
"properties": {
|
|
24
|
-
"maxSize": {
|
|
25
|
-
"default": "10M",
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"maxFiles": {
|
|
29
|
-
"default": 7,
|
|
30
|
-
"type": "integer",
|
|
31
|
-
"minimum": 0,
|
|
32
|
-
"maximum": 9007199254740991
|
|
33
|
-
},
|
|
34
|
-
"interval": {
|
|
35
|
-
"default": "daily",
|
|
36
|
-
"type": "string",
|
|
37
|
-
"enum": [
|
|
38
|
-
"daily",
|
|
39
|
-
"hourly",
|
|
40
|
-
"none"
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
"compress": {
|
|
44
|
-
"default": true,
|
|
45
|
-
"type": "boolean"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"required": [
|
|
49
|
-
"maxSize",
|
|
50
|
-
"maxFiles",
|
|
51
|
-
"interval",
|
|
52
|
-
"compress"
|
|
53
|
-
],
|
|
54
|
-
"additionalProperties": false
|
|
55
|
-
},
|
|
56
|
-
"levels": {
|
|
57
|
-
"type": "object",
|
|
58
|
-
"properties": {
|
|
59
|
-
"debug": {
|
|
60
|
-
"default": true,
|
|
61
|
-
"type": "boolean"
|
|
62
|
-
},
|
|
63
|
-
"info": {
|
|
64
|
-
"default": true,
|
|
65
|
-
"type": "boolean"
|
|
66
|
-
},
|
|
67
|
-
"warn": {
|
|
68
|
-
"default": true,
|
|
69
|
-
"type": "boolean"
|
|
70
|
-
},
|
|
71
|
-
"error": {
|
|
72
|
-
"default": true,
|
|
73
|
-
"type": "boolean"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"required": [
|
|
77
|
-
"debug",
|
|
78
|
-
"info",
|
|
79
|
-
"warn",
|
|
80
|
-
"error"
|
|
81
|
-
],
|
|
82
|
-
"additionalProperties": false
|
|
83
|
-
},
|
|
84
|
-
"format": {
|
|
85
|
-
"type": "object",
|
|
86
|
-
"properties": {
|
|
87
|
-
"timestamp": {
|
|
88
|
-
"default": true,
|
|
89
|
-
"type": "boolean"
|
|
90
|
-
},
|
|
91
|
-
"traceInfo": {
|
|
92
|
-
"default": true,
|
|
93
|
-
"type": "boolean"
|
|
94
|
-
},
|
|
95
|
-
"prettyPrint": {
|
|
96
|
-
"default": false,
|
|
97
|
-
"type": "boolean"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"required": [
|
|
101
|
-
"timestamp",
|
|
102
|
-
"traceInfo",
|
|
103
|
-
"prettyPrint"
|
|
104
|
-
],
|
|
105
|
-
"additionalProperties": false
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"required": [
|
|
109
|
-
"directory",
|
|
110
|
-
"filename",
|
|
111
|
-
"dateFormat",
|
|
112
|
-
"rotation",
|
|
113
|
-
"levels",
|
|
114
|
-
"format"
|
|
115
|
-
],
|
|
116
|
-
"additionalProperties": false
|
|
117
|
-
},
|
|
118
5
|
"pluginType": "observable",
|
|
119
6
|
"capabilities": {
|
|
120
7
|
"logging": {
|
|
@@ -14,118 +14,5 @@
|
|
|
14
14
|
"./docs/plugin.md"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": [],
|
|
17
|
-
"image": "./observable-logging-file.png"
|
|
18
|
-
"configSchema": {
|
|
19
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
20
|
-
"type": "object",
|
|
21
|
-
"properties": {
|
|
22
|
-
"directory": {
|
|
23
|
-
"default": "./logs",
|
|
24
|
-
"type": "string"
|
|
25
|
-
},
|
|
26
|
-
"filename": {
|
|
27
|
-
"default": "application-%DATE%.log",
|
|
28
|
-
"type": "string"
|
|
29
|
-
},
|
|
30
|
-
"dateFormat": {
|
|
31
|
-
"default": "YYYY-MM-DD",
|
|
32
|
-
"type": "string"
|
|
33
|
-
},
|
|
34
|
-
"rotation": {
|
|
35
|
-
"type": "object",
|
|
36
|
-
"properties": {
|
|
37
|
-
"maxSize": {
|
|
38
|
-
"default": "10M",
|
|
39
|
-
"type": "string"
|
|
40
|
-
},
|
|
41
|
-
"maxFiles": {
|
|
42
|
-
"default": 7,
|
|
43
|
-
"type": "integer",
|
|
44
|
-
"minimum": 0,
|
|
45
|
-
"maximum": 9007199254740991
|
|
46
|
-
},
|
|
47
|
-
"interval": {
|
|
48
|
-
"default": "daily",
|
|
49
|
-
"type": "string",
|
|
50
|
-
"enum": [
|
|
51
|
-
"daily",
|
|
52
|
-
"hourly",
|
|
53
|
-
"none"
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
"compress": {
|
|
57
|
-
"default": true,
|
|
58
|
-
"type": "boolean"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"required": [
|
|
62
|
-
"maxSize",
|
|
63
|
-
"maxFiles",
|
|
64
|
-
"interval",
|
|
65
|
-
"compress"
|
|
66
|
-
],
|
|
67
|
-
"additionalProperties": false
|
|
68
|
-
},
|
|
69
|
-
"levels": {
|
|
70
|
-
"type": "object",
|
|
71
|
-
"properties": {
|
|
72
|
-
"debug": {
|
|
73
|
-
"default": true,
|
|
74
|
-
"type": "boolean"
|
|
75
|
-
},
|
|
76
|
-
"info": {
|
|
77
|
-
"default": true,
|
|
78
|
-
"type": "boolean"
|
|
79
|
-
},
|
|
80
|
-
"warn": {
|
|
81
|
-
"default": true,
|
|
82
|
-
"type": "boolean"
|
|
83
|
-
},
|
|
84
|
-
"error": {
|
|
85
|
-
"default": true,
|
|
86
|
-
"type": "boolean"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"required": [
|
|
90
|
-
"debug",
|
|
91
|
-
"info",
|
|
92
|
-
"warn",
|
|
93
|
-
"error"
|
|
94
|
-
],
|
|
95
|
-
"additionalProperties": false
|
|
96
|
-
},
|
|
97
|
-
"format": {
|
|
98
|
-
"type": "object",
|
|
99
|
-
"properties": {
|
|
100
|
-
"timestamp": {
|
|
101
|
-
"default": true,
|
|
102
|
-
"type": "boolean"
|
|
103
|
-
},
|
|
104
|
-
"traceInfo": {
|
|
105
|
-
"default": true,
|
|
106
|
-
"type": "boolean"
|
|
107
|
-
},
|
|
108
|
-
"prettyPrint": {
|
|
109
|
-
"default": false,
|
|
110
|
-
"type": "boolean"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"required": [
|
|
114
|
-
"timestamp",
|
|
115
|
-
"traceInfo",
|
|
116
|
-
"prettyPrint"
|
|
117
|
-
],
|
|
118
|
-
"additionalProperties": false
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"required": [
|
|
122
|
-
"directory",
|
|
123
|
-
"filename",
|
|
124
|
-
"dateFormat",
|
|
125
|
-
"rotation",
|
|
126
|
-
"levels",
|
|
127
|
-
"format"
|
|
128
|
-
],
|
|
129
|
-
"additionalProperties": false
|
|
130
|
-
}
|
|
17
|
+
"image": "./observable-logging-file.png"
|
|
131
18
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsb/observable-logging-file",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.1",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"license": "(AGPL-3.0-only OR Commercial)",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "BetterCorp (PTY) Ltd",
|
|
7
|
-
"email": "
|
|
8
|
+
"email": "ninja@bettercorp.dev",
|
|
8
9
|
"url": "https://bettercorp.dev/"
|
|
9
10
|
},
|
|
10
11
|
"description": "File logging observable plugin for BSB with rotation and compression",
|
|
@@ -40,19 +41,18 @@
|
|
|
40
41
|
"@bsb/base": "^9.0.0"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
44
|
+
"@anyvali/js": "^0.2.0",
|
|
45
|
+
"rotating-file-stream": "^3.2.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/node": "^25.0.0",
|
|
48
49
|
"typescript": "^5.9.0",
|
|
49
50
|
"mocha": "^11.0.0",
|
|
50
|
-
"@bsb/base": "
|
|
51
|
+
"@bsb/base": "^9.0.0"
|
|
51
52
|
},
|
|
52
53
|
"engines": {
|
|
53
54
|
"node": ">=23.0.0",
|
|
54
55
|
"npm": ">=11.0.0"
|
|
55
56
|
},
|
|
56
|
-
"homepage": "https://io.bsbcode.dev/
|
|
57
|
+
"homepage": "https://io.bsbcode.dev/packages/nodejs/@bsb/observable-logging-file"
|
|
57
58
|
}
|
|
58
|
-
|