@geeko/log 1.0.0 → 1.1.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 +16 -1
- package/dist/services/LogService.js +5 -0
- package/dist/types/LogOptions.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
# Geeko Log
|
|
1
|
+
# Geeko Log
|
|
2
|
+
[![License][license-image]][license-url]
|
|
3
|
+
[![Downloads][downloads-image]][downloads-url]
|
|
4
|
+
|
|
5
|
+
# install
|
|
6
|
+
|
|
7
|
+
With [npm](https://npmjs.org) do:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install @geeko/log
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
[license-url]: LICENSE
|
|
14
|
+
[license-image]: https://img.shields.io/badge/License-MIT-blue
|
|
15
|
+
[downloads-image]: https://img.shields.io/npm/dm/%40geeko%2Flog
|
|
16
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=@geeko/log
|
|
@@ -11,6 +11,7 @@ class LogService {
|
|
|
11
11
|
constructor(options) {
|
|
12
12
|
this._logger = options?.logger ?? (0, winston_1.createLogger)({
|
|
13
13
|
level: options?.level ?? "info",
|
|
14
|
+
silent: options?.level === "quiet",
|
|
14
15
|
transports: [
|
|
15
16
|
new ConsoleTransport_1.SonicConsoleTransport()
|
|
16
17
|
]
|
|
@@ -67,6 +68,7 @@ class LogService {
|
|
|
67
68
|
const metadata = this.getMetadata();
|
|
68
69
|
const parentTemplate = metadata?.["template"] || logger_1.appBadgeTemplate;
|
|
69
70
|
const logger = (0, winston_1.createLogger)({
|
|
71
|
+
silent: (options?.level ?? this._level) === "quiet",
|
|
70
72
|
transports: this._logger.transports.slice(0)
|
|
71
73
|
});
|
|
72
74
|
const logService = new LogService({
|
|
@@ -78,6 +80,9 @@ class LogService {
|
|
|
78
80
|
return logService;
|
|
79
81
|
}
|
|
80
82
|
spinner(enabled, marker) {
|
|
83
|
+
if (this._level === "quiet") {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
81
86
|
this._loading = enabled;
|
|
82
87
|
if (enabled) {
|
|
83
88
|
this._spinner.start({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type Style = (text: string, options?: LogOptions) => string;
|
|
2
|
-
export type LogLevel = "info" | "warn" | "error" | "debug" | "verbose";
|
|
2
|
+
export type LogLevel = "info" | "warn" | "error" | "debug" | "verbose" | "quiet";
|
|
3
3
|
export type LogOptions = {
|
|
4
4
|
level: LogLevel;
|
|
5
5
|
label?: string;
|