@travetto/log 5.0.15 → 5.0.17
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 +1 -1
- package/README.md +3 -3
- package/package.json +4 -4
- package/src/common.ts +3 -3
- package/src/types.ts +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -29,14 +29,14 @@ export class CommonLoggerConfig {
|
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
In addition to these simple overrides, the [CommonLogger](https://github.com/travetto/travetto/tree/main/module/log/src/common.ts#L12) can be extended by providing an implementation of either a [LogFormatter](https://github.com/travetto/travetto/tree/main/module/log/src/types.ts#L34) or [LogAppender](https://github.com/travetto/travetto/tree/main/module/log/src/types.ts#L26), with the declared symbol of `
|
|
32
|
+
In addition to these simple overrides, the [CommonLogger](https://github.com/travetto/travetto/tree/main/module/log/src/common.ts#L12) can be extended by providing an implementation of either a [LogFormatter](https://github.com/travetto/travetto/tree/main/module/log/src/types.ts#L34) or [LogAppender](https://github.com/travetto/travetto/tree/main/module/log/src/types.ts#L26), with the declared symbol of `LogCommonSymbol`.
|
|
33
33
|
|
|
34
34
|
**Code: Sample Common Formatter**
|
|
35
35
|
```typescript
|
|
36
36
|
import { Injectable } from '@travetto/di';
|
|
37
|
-
import { LogFormatter,
|
|
37
|
+
import { LogFormatter, LogCommonSymbol, LogEvent } from '@travetto/log';
|
|
38
38
|
|
|
39
|
-
@Injectable(
|
|
39
|
+
@Injectable(LogCommonSymbol)
|
|
40
40
|
export class SampleFormatter implements LogFormatter {
|
|
41
41
|
|
|
42
42
|
format(e: LogEvent): string {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/log",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.17",
|
|
4
4
|
"description": "Logging framework that integrates at the console.log level.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"directory": "module/log"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@travetto/config": "^5.0.
|
|
27
|
-
"@travetto/di": "^5.0.
|
|
28
|
-
"@travetto/terminal": "^5.0.
|
|
26
|
+
"@travetto/config": "^5.0.15",
|
|
27
|
+
"@travetto/di": "^5.0.15",
|
|
28
|
+
"@travetto/terminal": "^5.0.17"
|
|
29
29
|
},
|
|
30
30
|
"travetto": {
|
|
31
31
|
"displayName": "Logging"
|
package/src/common.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ConsoleLogAppender } from './appender/console';
|
|
|
6
6
|
import { FileLogAppender } from './appender/file';
|
|
7
7
|
import { JsonLogFormatter } from './formatter/json';
|
|
8
8
|
import { LineLogFormatter } from './formatter/line';
|
|
9
|
-
import { LogAppender, LogFormatter, LogEvent,
|
|
9
|
+
import { LogAppender, LogFormatter, LogEvent, LogCommonSymbol, Logger } from './types';
|
|
10
10
|
|
|
11
11
|
@Config('log')
|
|
12
12
|
export class CommonLoggerConfig {
|
|
@@ -23,10 +23,10 @@ export class CommonLogger implements Logger {
|
|
|
23
23
|
@Inject()
|
|
24
24
|
config: CommonLoggerConfig;
|
|
25
25
|
|
|
26
|
-
@Inject(
|
|
26
|
+
@Inject(LogCommonSymbol, { optional: true })
|
|
27
27
|
formatter: LogFormatter;
|
|
28
28
|
|
|
29
|
-
@Inject(
|
|
29
|
+
@Inject(LogCommonSymbol, { optional: true })
|
|
30
30
|
appender: LogAppender;
|
|
31
31
|
|
|
32
32
|
async postConstruct(): Promise<void> {
|