# Json layout

  • type - json
  • separator - string - char that separate each line

# Example

import {Logger} from "@tsed/logger";

const logger = new Logger("loggerName");

logger.appenders
  .set("std-log-json", {
      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');
1
2
3
4
5
6
7
8
9
10
11
12

This example outputs the following:

{"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":{}},
1
2
3