本文整理汇总了TypeScript中winston.remove函数的典型用法代码示例。如果您正苦于以下问题:TypeScript remove函数的具体用法?TypeScript remove怎么用?TypeScript remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: InitializeLogger
public static InitializeLogger() : void {
//initialize the winston logger with daily log rotates
let env : string = process.env.NODE_ENV || "development";
env = env.trim();
let logFilePath : string = path.join(__dirname, "../../logs");
//create the log file directory is it does not exist
if(!fs.existsSync(logFilePath)) {
fs.mkdirSync(logFilePath);
}
if(env == "development") {
Winston.add(winstonRotateFile, {
filename: path.join(logFilePath, "_info.log"),
datePattern: "yyyy-MM-dd",
prepend: true,
prettyPrint: true,
level: "info"
});
}
else {
Winston.add(winstonRotateFile, {
filename: path.join(logFilePath, "_error.log"),
datePattern: "yyyy-MM-dd",
prepend: true,
prettyPrint: true,
level: "warn"
});
//remove console output in production
Winston.remove(Winston.transports.Console);
}
Winston.handleExceptions(new winstonRotateFile({
filename: path.join(logFilePath, "_exceptions.log"),
datePattern: "yyyy-MM-dd",
prepend: true,
prettyPrint: true
}));
}
开发者ID:andwoo,项目名称:grouptube2,代码行数:39,代码来源:Logger.ts
示例2: winstonConfiguration
function winstonConfiguration() {
function consoleConfiguration() {
return {
stringify: obj => JSON.stringify(obj, null, '\t'),
json: true
};
}
function fileConfiguration(fileName) {
return {
filename: path.join(__dirname, fileName),
stringify: obj => JSON.stringify(obj, null, '\t')
};
}
winston
.remove(winston.transports.Console)
.add(winston.transports.Console, consoleConfiguration())
.add(winston.transports.File, fileConfiguration('bullshit.json'));
winston.handleExceptions(new winston.transports.File(fileConfiguration('exceptions.json')));
}
开发者ID:radotzki,项目名称:bullshit-server,代码行数:22,代码来源:app.ts
示例3: enableProdMode
enableProdMode();
const app = express();
const ROOT = path.join(path.resolve(''));
/*
* Configure Winston
*/
winston.addColors({
debug: 'green',
info: 'cyan',
silly: 'magenta',
warn: 'yellow',
error: 'red'
});
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {
level: process.env.LOG_LEVEL,
colorize: true
});
/*
* Connect to database
* Info: See database.ts to configure settings
*/
import { ConnectToDatabase } from './database';
ConnectToDatabase();
开发者ID:Mandosis,项目名称:2MEAN,代码行数:29,代码来源:server.ts
注:本文中的winston.remove函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论