How to use the egg-logger.Logger function in egg-logger

To help you get started, we’ve selected a few egg-logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PedroGao / lin-cms-koa-braver / packages / core / lib / extend / logging.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("../config");
const logger_1 = require("../logger");
const egg_logger_1 = require("egg-logger");
// 默认配置
let options = {
    level: 'INFO',
    dir: 'logs',
    sizeLimit: 1024 * 1024 * 5,
    file: true
};
const logConf = config_1.config.getItem('log');
// 融合配置
options = Object.assign({}, options, logConf);
exports.logger = new egg_logger_1.Logger({});
// 如果file开启,则打开,否则关闭
if (options.file) {
    exports.logger.set('file', 
    // 日志输出到文件
    new logger_1.FileTransport({
        dir: options.dir,
        sizeLimit: options.sizeLimit,
        level: options.level
    }));
}
exports.logger.set('console', 
// 日志输出到终端
new logger_1.ConsoleTransport({
    level: options.level
}));
/**
github TaleLin / lin-cms-koa-core / example / logger.js View on Github external
const Logger = require('egg-logger').Logger;

const { FileTransport } = require('../lin/logger/file');
const { ConsoleTransport } = require('../lin/logger/console');

const logger = new Logger();
logger.set(
  'file',
  new FileTransport({
    dir: 'log',
    sizeLimit: 1024 * 5,
    level: 'DEBUG'
  })
);
logger.set(
  'console',
  new ConsoleTransport({
    level: 'DEBUG'
  })
);

logger.debug('debug foo'); // only output to stdout
github node-modules / cluster-client / lib / default_logger.js View on Github external
'use strict';

const { Logger, ConsoleTransport } = require('egg-logger');
const { consoleFormatter } = require('egg-logger/lib/utils');
const logger = new Logger();
logger.set('console', new ConsoleTransport({
  level: 'INFO',
  formatter: consoleFormatter,
}));

module.exports = logger;
github midwayjs / pandora / packages / core-sdk / src / CoreSDK.ts View on Github external
constructor(options: ICoreSDKOptions) {
    this.options = options;
    this.coreContext = {
      mode: options.mode,
      appName: options.appName,
      appDir: options.appDir,
      processName: options.processName || options.mode,
      config: {},
      logger: new Logger({}),
    };
    debug('constructing CoreSDK %j', options);
    if(this.options.extendContext) {
      Object.assign(this.coreContext, this.options.extendContext);
    }
    this.loadConfig(defaultConfig, dirname(require.resolve('./pandoraConfig')));
  }
github eggjs / egg-development-proxyworker / lib / utils / console.js View on Github external
'use strict';

const Logger = require('egg-logger').Logger;
const ConsoleTransport = require('egg-logger').ConsoleTransport;

const logger = new Logger();

logger.set('console', new ConsoleTransport({
  level: 'DEBUG',
}));

module.exports = logger;

egg-logger

egg logger

MIT
Latest version published 6 months ago

Package Health Score

76 / 100
Full package analysis

Similar packages