本文整理汇总了TypeScript中winston.loggers.add方法的典型用法代码示例。如果您正苦于以下问题:TypeScript loggers.add方法的具体用法?TypeScript loggers.add怎么用?TypeScript loggers.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类winston.loggers
的用法示例。
在下文中一共展示了loggers.add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: LogFactory
export function LogFactory($args): Ha4usLogger {
winston.loggers.add($args.name, {
console: {
colorize: true,
level: $args.loglevel,
prettyPrint: true,
stderrLevels: ['error', 'warn'],
timestamp: true,
},
})
return winston.loggers.get($args.name)
}
示例2: require
var async = require('async');
var requestenhanced = require('request-enhanced');
var config = require('./config');
var moment = require('moment');
var winston = require('winston');
require('winston-email');
var configuration = new config.Config;
winston.loggers.add('logger', {
email: {
from : configuration.loggeremailfrom,
to : configuration.loggeremailto,
service: configuration.loggeremailservice,
auth : configuration.loggeremailauth,
tags : configuration.loggeremailtags
}
// other transports
});
var logger = winston.loggers.get('logger');
export class BusinessLogic {
postAjaj(url, objectToSend, cb) {
var default_headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-us,en;q=0.5',
示例3:
*
*/
// Boilerplate for a test
import { AssistResponse } from '../actions-on-google'
import { ActionsOnGoogleAva } from '../actions-on-google-ava'
import test from 'ava'
import * as sinon from 'sinon'
import * as winston from 'winston'
import * as Sample from './expected'
// Default logger
winston.loggers.add('DEFAULT_LOGGER', {
console: {
level: 'error',
colorize: true,
label: 'Default logger',
json: true,
timestamp: true,
},
})
const testCredentialsFile = '../../test/test-credentials.json'
// Mock implementation of gRPC call that allows server response to be mocked
// tslint:disable-next-line
const getMockConversation = (data: any) => {
// Wrap AoG data into object
const dataToSend = {
debug_info: {
aog_agent_to_assistant_json: JSON.stringify(data),
},