Socket
Socket
Sign inDemoInstall

@tsed/logger

Package Overview
Dependencies
16
Maintainers
5
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.3.0 to 5.4.0

1

lib/appenders/decorators/appender.js

@@ -11,2 +11,3 @@ "use strict";

target.prototype.appenderOptions = options;
target.$name = options.name;
AppendersRegistry_1.AppendersRegistry.set(options.name, { provide: target });

@@ -13,0 +14,0 @@ };

77

lib/appenders/index.d.ts

@@ -1,74 +0,7 @@

/**
* ## Appenders
*
* Appenders serialise log events to some form of output. They can write to files, send emails, send data over the network. All appenders have a type which determines which appender gets used. For example:
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "stdout", level: ["debug", "info", "trace"]
* })
* .push({
* type: "stderr", level: ["error", "fatal", "warn"]
* });
* .push({
* type: "file", filename: "logfile.log"
* });
* ```
*
* This defines three appenders named ‘stdout’, ‘stderr’ and ‘file’.
*
* ### Core Appenders
*
* The following appenders are included with ts-log-debug.
*
* * console
* * file
* * stderr
* * stdout
*
* ### Custom Appender
*
* ts-log-debug can load appenders from outside the core appenders. The type config value is used as a require path if no matching appender can be found. For example, the following configuration will create an appender with decorators:
*
* ```typescript
* // consoleAppender.ts
* import {Appender, BaseAppender, LogEvent} from "ts-log-debug";
* const consoleLog = console.log.bind(console);
*
* &arobase;Appender({name: "console2"})
* export class ConsoleAppender extends BaseAppender {
* write(loggingEvent: LogEvent) {
* consoleLog(this.layout(loggingEvent, this.config.timezoneOffset));
* }
* }
* ```
*
* This appender can be use like this:
*
* ```typescript
* import {Logger} from "ts-log-debug";
* import "./consoleAppender.ts"
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console2", level: ["debug", "info", "trace"]
* });
* ```
*
* @module appenders
* @preferred
*/
/** */
import "./components/ConsoleAppender";
import "./components/FileAppender";
import "./components/StderrAppender";
import "./components/StdoutAppender";
export * from "./components/ConsoleAppender";
export * from "./components/FileAppender";
export * from "./components/StderrAppender";
export * from "./components/StdoutAppender";
export * from "./interfaces/AppenderConfiguration";
export * from "./class/BaseAppender";
export * from "./decorators/appender";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/**
* ## Appenders
*
* Appenders serialise log events to some form of output. They can write to files, send emails, send data over the network. All appenders have a type which determines which appender gets used. For example:
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "stdout", level: ["debug", "info", "trace"]
* })
* .push({
* type: "stderr", level: ["error", "fatal", "warn"]
* });
* .push({
* type: "file", filename: "logfile.log"
* });
* ```
*
* This defines three appenders named ‘stdout’, ‘stderr’ and ‘file’.
*
* ### Core Appenders
*
* The following appenders are included with ts-log-debug.
*
* * console
* * file
* * stderr
* * stdout
*
* ### Custom Appender
*
* ts-log-debug can load appenders from outside the core appenders. The type config value is used as a require path if no matching appender can be found. For example, the following configuration will create an appender with decorators:
*
* ```typescript
* // consoleAppender.ts
* import {Appender, BaseAppender, LogEvent} from "ts-log-debug";
* const consoleLog = console.log.bind(console);
*
* &arobase;Appender({name: "console2"})
* export class ConsoleAppender extends BaseAppender {
* write(loggingEvent: LogEvent) {
* consoleLog(this.layout(loggingEvent, this.config.timezoneOffset));
* }
* }
* ```
*
* This appender can be use like this:
*
* ```typescript
* import {Logger} from "ts-log-debug";
* import "./consoleAppender.ts"
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console2", level: ["debug", "info", "trace"]
* });
* ```
*
* @module appenders
* @preferred
*/
/** */
require("./components/ConsoleAppender");
require("./components/FileAppender");
require("./components/StderrAppender");
require("./components/StdoutAppender");
tslib_1.__exportStar(require("./components/ConsoleAppender"), exports);
tslib_1.__exportStar(require("./components/FileAppender"), exports);
tslib_1.__exportStar(require("./components/StderrAppender"), exports);
tslib_1.__exportStar(require("./components/StdoutAppender"), exports);
tslib_1.__exportStar(require("./class/BaseAppender"), exports);
tslib_1.__exportStar(require("./decorators/appender"), exports);
//# sourceMappingURL=index.js.map

@@ -1,19 +0,1 @@

/**
* @preferred
*
* @fileoverview ts-log-debug is a library to log in TypeScript.
*
* <h3>Example:</h3>
* <pre>
* import {$log} from "ts-log-debug";
* $log.level = "debug";
* $log.name = "APP";
* $log.debug("Some debug messages");
* </pre>
*
* @author Lenzotti Romain
* @since 2017-06-18
* @static
* Website:
*/
export * from "./core";

@@ -20,0 +2,0 @@ export * from "./appenders";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/**
* @preferred
*
* @fileoverview ts-log-debug is a library to log in TypeScript.
*
* <h3>Example:</h3>
* <pre>
* import {$log} from "ts-log-debug";
* $log.level = "debug";
* $log.name = "APP";
* $log.debug("Some debug messages");
* </pre>
*
* @author Lenzotti Romain
* @since 2017-06-18
* @static
* Website:
*/
tslib_1.__exportStar(require("./core"), exports);

@@ -23,0 +5,0 @@ tslib_1.__exportStar(require("./appenders"), exports);

import { IBasicLayoutConfiguration } from "../interfaces/BasicLayoutConfiguration";
import { BaseLayout } from "./BaseLayout";
export declare class Layouts {
static get(name: string, config: IBasicLayoutConfiguration): any;
static get(name: string | any, config: IBasicLayoutConfiguration): BaseLayout;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module layouts
*/
/** */
const LayoutsRegistry_1 = require("../registries/LayoutsRegistry");
class Layouts {
static get(name, config) {
if (typeof name !== "string") {
name = name.$name;
}
if (!LayoutsRegistry_1.LayoutsRegistry.has(name)) {

@@ -14,3 +13,3 @@ name = "colored";

}
const layoutKlass = LayoutsRegistry_1.LayoutsRegistry.get(name.replace(/layout/gi, ""));
const layoutKlass = LayoutsRegistry_1.LayoutsRegistry.get(name);
return new layoutKlass.provide(config);

@@ -17,0 +16,0 @@ }

@@ -18,3 +18,3 @@ import { BaseLayout } from "../class/BaseLayout";

* - %z pid
* - %x{<tokenname>} add dynamic tokens to your log. Tokens are specified in the tokens parameter
* - %x{[tokenname]} add dynamic tokens to your log. Tokens are specified in the tokens parameter
* You can use %[ and %] to define a colored block.

@@ -21,0 +21,0 @@ *

@@ -24,3 +24,3 @@ "use strict";

* - %z pid
* - %x{<tokenname>} add dynamic tokens to your log. Tokens are specified in the tokens parameter
* - %x{[tokenname]} add dynamic tokens to your log. Tokens are specified in the tokens parameter
* You can use %[ and %] to define a colored block.

@@ -27,0 +27,0 @@ *

@@ -6,2 +6,3 @@ "use strict";

return (target) => {
target.$name = options.name;
LayoutsRegistry_1.LayoutsRegistry.set(options.name, { provide: target });

@@ -8,0 +9,0 @@ };

@@ -1,287 +0,1 @@

/**
* ## Layouts
*
* Layouts are functions used by appenders to format log events for output. They take a log event as an argument and return a string. Log4js comes with several appenders built-in, and provides ways to create your own if these are not suitable.
*
* For most use cases you will not need to configure layouts - there are some appenders which do not need layouts defined (for example, logFaces-UDP); all the appenders that use layouts will have a sensible default defined.
*
* ### Configuration
*
* Most appender configuration will take a field called layout, which is an object - typically with a single field type which is the name of a layout defined below. Some layouts require extra configuration options, which should be included in the same object.
*
* ### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "stdout", layout: {type: "basic"}, level: ["debug", "info", "trace"]
* });
* ```
* > This configuration replaces the stdout appender’s default colored layout with basic layout.
*
* ### Built-in Layouts
* #### Basic
*
* * type - basic
*
* Basic layout will output the timestamp, level, category, followed by the formatted log event data.
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "stdout", layout: {type: "basic"}, level: ["debug", "info", "trace"]
* });
* logger.debug('Log something');
* ```
*
* This will output:
*
* ```bash
* [2017-03-30 07:57:00.113] [DEBUG] [loggerName] - Log something
*
*
* #### Colored
*
* - type - colored
*
* This layout is the same as basic, except that the timestamp, level and category will be colored according to the log event’s level (if your terminal/file supports it - if you see some weird characters in your output and no color then you should probably switch to basic). The colors used are:
*
* * TRACE - `blue`
* * DEBUG - `cyan`
* * INFO - `green`
* * WARN - `yellow`
* * ERROR - `red`
* * FATAL - `magenta`
*
* #### Message Pass-Through
*
* * type - messagePassThrough
*
* This layout just formats the log event data, and does not output a timestamp, level or category. It is typically used in appenders that serialise the events using a specific format (e.g. gelf).
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout: {type: "messagePassThrough"}, level: ["debug", "info", "trace"]
* });
* logger.debug('Log something');
* ```
*
* This will output:
*
* ```bash
* Log something
* ```
*
* #### Dummy
*
* - type - dummy
*
* This layout only outputs the first value in the log event`s data.
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout: {type: "dummy"}, level: ["debug", "info", "trace"]
* });
*
* logger.debug('Cheese is too ripe! Cheese was: ', cheeseName);
* ```
*
* This will output:
*
* ```bash
* Cheese is too ripe! Cheese was:
* ```
*
* #### Json
*
* - type - json
* - seperator - string - char that separate each line
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout: {type: "json", separator: ","}, level: ["debug", "info", "trace"]
* });
*
* logger.info('this is just a test');
* logger.error('of a custom appender');
* logger.warn('that outputs json');
* ```
* This example outputs the following:
*
* ```bash
* {"startTime":"2017-06-05T22:23:08.479Z","categoryName":"json-test","data":["this is just a test"],"level":"INFO","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["of a custom appender"],"level":"ERROR","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["that outputs json"],"level""WARN","context":{}},
* ```
*
* #### Pattern
*
* - type - pattern
* - pattern - string - specifier for the output format, using placeholders as described below
* - tokens - object (optional) - user-defined tokens to be used in the pattern
*
* #### Pattern format
*
* The pattern string can contain any characters, but sequences beginning with `%` will be replaced with values taken from the log event, and other environmental values. Format for specifiers is `%[padding].[truncation][field]{[format]} -` padding and truncation are optional, and format only applies to a few tokens (notably, date). e.g. `%5.10p -` left pad the log level by 5 characters, up to a max of 10
*
* Fields can be any of:
*
* * `%r` time in toLocaleTimeString format
* * `%p` log level
* * `%c` log category
* * `%h` hostname
* * `%m` log data
* * `%d` date, formatted - default is `ISO8601`, format options are: `ISO8601`, `ISO8601_WITH_TZ_OFFSET`, `ABSOLUTE`, `DATE`, or any string compatible with the date-format library. e.g. `%d{DATE}, %d{yyyy/MM/dd-hh.mm.ss}`
* * `%% % -` for when you want a literal % in your output
* * `%n` newline
* * `%z` process id (from process.pid)
* * `%x{<tokenname>}` add dynamic tokens to your log. Tokens are specified in the tokens parameter.
* * `%X{<tokenname>}` add values from the Logger context. Tokens are keys into the context values.
* * `%[` start a colored block (color will be taken from the log level, similar to coloredLayout)
* * `%]` end a colored block
*
* #### Tokens
*
* User-defined tokens can be either a string or a function. Functions will be passed the log event, and should return a string. For example, you could define a custom token that outputs the log event's context value for `user` like so:
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "messagePassThrough",
* layout: {
* type: 'pattern',
* pattern: '%d %p %c %x{user} %m%n',
* tokens: {
* user: (logEvent) => AuthLibrary.currentUser()
* }
* },
* level: ["debug", "info", "trace"]
* });
* logger.info('doing something.');
* ```
*
* This would output:
*
* ```bash
* 2017-06-01 08:32:56.283 INFO default charlie doing something.
* ```
*
* You can also use the Logger context to store tokens (sometimes called Nested Diagnostic Context, or Mapped Diagnostic Context) and use them in your layouts.
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "messagePassThrough",
* layout: {
* type: 'pattern',
* pattern: '%d %p %c %X{user} %m%n',
* },
* level: ["debug", "info", "trace"]
* });
* logger.addContext('user', 'charlie')
* logger.info('doing something.');
* ```
*
* This would output:
* ```bash
* 2017-06-01 08:32:56.283 INFO default charlie doing something.
* ```
*
* > Note that you can also add functions to the Logger Context, and they will be passed the logEvent as well.
*
* #### Create your own layouts
*
* You can add your own layouts with `@Layout()` before pushing a configure to your logger.
*
* ```typescript
* // customLayout.ts
* import {BaseLayout, LogEvent, Layout} from "ts-log-debug";
* import {formatLogData} from "ts-log-debug/lib/utils/inpectUtils";
*
* @ Layout({name: "customJson"})
* export class JsonLayout extends BaseLayout {
* transform(loggingEvent: LogEvent, timezoneOffset?): string {
* const log = {
* startTime: loggingEvent.startTime,
* categoryName: loggingEvent.categoryName,
* level: loggingEvent.level.toString(),
* data: loggingEvent.data,
* context: loggingEvent.context
* };
*
* log.data = log.data.map((data) => formatLogData([data]));
*
* return JSON.stringify(log) + (this.config["separator"] || "");
* };
* }
* ```
*
* This layout can be use like this:
*
* ```typescript
* import {Logger} from "ts-log-debug";
* import "./customLayout.ts"
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout:{type: "customJson"}, level: ["debug", "info", "trace"]
* });
* logger.info('this is just a test');
* logger.error('of a custom appender');
* logger.warn('that outputs json');
* ```
*
* This example outputs the following:
*
* ```bash
* {"startTime":"2017-06-05T22:23:08.479Z","categoryName":"json-test","data":["this is just a test"],"level":"INFO","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["of a custom appender"],"level":"ERROR","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["that outputs json"],"level""WARN","context":{}},
* ```
*
* @module layouts
* @preferred
*/
/** */
export * from "./constants/logColors";

@@ -293,7 +7,7 @@ export * from "./class/Layouts";

export * from "./utils/colorizeUtils";
import "./components/BasicLayout";
import "./components/ColoredLayout";
import "./components/DummyLayout";
import "./components/MessagePassThroughLayout";
import "./components/PatternLayout";
import "./components/JsonLayout";
export * from "./components/BasicLayout";
export * from "./components/ColoredLayout";
export * from "./components/DummyLayout";
export * from "./components/MessagePassThroughLayout";
export * from "./components/PatternLayout";
export * from "./components/JsonLayout";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/**
* ## Layouts
*
* Layouts are functions used by appenders to format log events for output. They take a log event as an argument and return a string. Log4js comes with several appenders built-in, and provides ways to create your own if these are not suitable.
*
* For most use cases you will not need to configure layouts - there are some appenders which do not need layouts defined (for example, logFaces-UDP); all the appenders that use layouts will have a sensible default defined.
*
* ### Configuration
*
* Most appender configuration will take a field called layout, which is an object - typically with a single field type which is the name of a layout defined below. Some layouts require extra configuration options, which should be included in the same object.
*
* ### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "stdout", layout: {type: "basic"}, level: ["debug", "info", "trace"]
* });
* ```
* > This configuration replaces the stdout appender’s default colored layout with basic layout.
*
* ### Built-in Layouts
* #### Basic
*
* * type - basic
*
* Basic layout will output the timestamp, level, category, followed by the formatted log event data.
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "stdout", layout: {type: "basic"}, level: ["debug", "info", "trace"]
* });
* logger.debug('Log something');
* ```
*
* This will output:
*
* ```bash
* [2017-03-30 07:57:00.113] [DEBUG] [loggerName] - Log something
*
*
* #### Colored
*
* - type - colored
*
* This layout is the same as basic, except that the timestamp, level and category will be colored according to the log event’s level (if your terminal/file supports it - if you see some weird characters in your output and no color then you should probably switch to basic). The colors used are:
*
* * TRACE - `blue`
* * DEBUG - `cyan`
* * INFO - `green`
* * WARN - `yellow`
* * ERROR - `red`
* * FATAL - `magenta`
*
* #### Message Pass-Through
*
* * type - messagePassThrough
*
* This layout just formats the log event data, and does not output a timestamp, level or category. It is typically used in appenders that serialise the events using a specific format (e.g. gelf).
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout: {type: "messagePassThrough"}, level: ["debug", "info", "trace"]
* });
* logger.debug('Log something');
* ```
*
* This will output:
*
* ```bash
* Log something
* ```
*
* #### Dummy
*
* - type - dummy
*
* This layout only outputs the first value in the log event`s data.
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout: {type: "dummy"}, level: ["debug", "info", "trace"]
* });
*
* logger.debug('Cheese is too ripe! Cheese was: ', cheeseName);
* ```
*
* This will output:
*
* ```bash
* Cheese is too ripe! Cheese was:
* ```
*
* #### Json
*
* - type - json
* - seperator - string - char that separate each line
*
* #### Example
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout: {type: "json", separator: ","}, level: ["debug", "info", "trace"]
* });
*
* logger.info('this is just a test');
* logger.error('of a custom appender');
* logger.warn('that outputs json');
* ```
* This example outputs the following:
*
* ```bash
* {"startTime":"2017-06-05T22:23:08.479Z","categoryName":"json-test","data":["this is just a test"],"level":"INFO","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["of a custom appender"],"level":"ERROR","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["that outputs json"],"level""WARN","context":{}},
* ```
*
* #### Pattern
*
* - type - pattern
* - pattern - string - specifier for the output format, using placeholders as described below
* - tokens - object (optional) - user-defined tokens to be used in the pattern
*
* #### Pattern format
*
* The pattern string can contain any characters, but sequences beginning with `%` will be replaced with values taken from the log event, and other environmental values. Format for specifiers is `%[padding].[truncation][field]{[format]} -` padding and truncation are optional, and format only applies to a few tokens (notably, date). e.g. `%5.10p -` left pad the log level by 5 characters, up to a max of 10
*
* Fields can be any of:
*
* * `%r` time in toLocaleTimeString format
* * `%p` log level
* * `%c` log category
* * `%h` hostname
* * `%m` log data
* * `%d` date, formatted - default is `ISO8601`, format options are: `ISO8601`, `ISO8601_WITH_TZ_OFFSET`, `ABSOLUTE`, `DATE`, or any string compatible with the date-format library. e.g. `%d{DATE}, %d{yyyy/MM/dd-hh.mm.ss}`
* * `%% % -` for when you want a literal % in your output
* * `%n` newline
* * `%z` process id (from process.pid)
* * `%x{<tokenname>}` add dynamic tokens to your log. Tokens are specified in the tokens parameter.
* * `%X{<tokenname>}` add values from the Logger context. Tokens are keys into the context values.
* * `%[` start a colored block (color will be taken from the log level, similar to coloredLayout)
* * `%]` end a colored block
*
* #### Tokens
*
* User-defined tokens can be either a string or a function. Functions will be passed the log event, and should return a string. For example, you could define a custom token that outputs the log event's context value for `user` like so:
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "messagePassThrough",
* layout: {
* type: 'pattern',
* pattern: '%d %p %c %x{user} %m%n',
* tokens: {
* user: (logEvent) => AuthLibrary.currentUser()
* }
* },
* level: ["debug", "info", "trace"]
* });
* logger.info('doing something.');
* ```
*
* This would output:
*
* ```bash
* 2017-06-01 08:32:56.283 INFO default charlie doing something.
* ```
*
* You can also use the Logger context to store tokens (sometimes called Nested Diagnostic Context, or Mapped Diagnostic Context) and use them in your layouts.
*
* ```typescript
* import {Logger} from "ts-log-debug";
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "messagePassThrough",
* layout: {
* type: 'pattern',
* pattern: '%d %p %c %X{user} %m%n',
* },
* level: ["debug", "info", "trace"]
* });
* logger.addContext('user', 'charlie')
* logger.info('doing something.');
* ```
*
* This would output:
* ```bash
* 2017-06-01 08:32:56.283 INFO default charlie doing something.
* ```
*
* > Note that you can also add functions to the Logger Context, and they will be passed the logEvent as well.
*
* #### Create your own layouts
*
* You can add your own layouts with `@Layout()` before pushing a configure to your logger.
*
* ```typescript
* // customLayout.ts
* import {BaseLayout, LogEvent, Layout} from "ts-log-debug";
* import {formatLogData} from "ts-log-debug/lib/utils/inpectUtils";
*
* @ Layout({name: "customJson"})
* export class JsonLayout extends BaseLayout {
* transform(loggingEvent: LogEvent, timezoneOffset?): string {
* const log = {
* startTime: loggingEvent.startTime,
* categoryName: loggingEvent.categoryName,
* level: loggingEvent.level.toString(),
* data: loggingEvent.data,
* context: loggingEvent.context
* };
*
* log.data = log.data.map((data) => formatLogData([data]));
*
* return JSON.stringify(log) + (this.config["separator"] || "");
* };
* }
* ```
*
* This layout can be use like this:
*
* ```typescript
* import {Logger} from "ts-log-debug";
* import "./customLayout.ts"
*
* const logger = new Logger("loggerName");
*
* logger.appenders
* .push({
* type: "console", layout:{type: "customJson"}, level: ["debug", "info", "trace"]
* });
* logger.info('this is just a test');
* logger.error('of a custom appender');
* logger.warn('that outputs json');
* ```
*
* This example outputs the following:
*
* ```bash
* {"startTime":"2017-06-05T22:23:08.479Z","categoryName":"json-test","data":["this is just a test"],"level":"INFO","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["of a custom appender"],"level":"ERROR","context":{}},
* {"startTime":"2017-06-05T22:23:08.483Z","categoryName":"json-test","data":["that outputs json"],"level""WARN","context":{}},
* ```
*
* @module layouts
* @preferred
*/
/** */
tslib_1.__exportStar(require("./constants/logColors"), exports);

@@ -295,8 +9,8 @@ tslib_1.__exportStar(require("./class/Layouts"), exports);

tslib_1.__exportStar(require("./utils/colorizeUtils"), exports);
require("./components/BasicLayout");
require("./components/ColoredLayout");
require("./components/DummyLayout");
require("./components/MessagePassThroughLayout");
require("./components/PatternLayout");
require("./components/JsonLayout");
tslib_1.__exportStar(require("./components/BasicLayout"), exports);
tslib_1.__exportStar(require("./components/ColoredLayout"), exports);
tslib_1.__exportStar(require("./components/DummyLayout"), exports);
tslib_1.__exportStar(require("./components/MessagePassThroughLayout"), exports);
tslib_1.__exportStar(require("./components/PatternLayout"), exports);
tslib_1.__exportStar(require("./components/JsonLayout"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@tsed/logger",
"version": "5.3.0",
"version": "5.4.0",
"description": "A multi channel logger written in TypeScript.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc