本文整理汇总了TypeScript中Logger.Logger类的典型用法代码示例。如果您正苦于以下问题:TypeScript Logger类的具体用法?TypeScript Logger怎么用?TypeScript Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logger类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
app.use((err, req, res, next) => {
Logger.info(err.stack);
res.status(500).send({
"status": "internal error",
"message": err.stack,
});
});
示例2: constructor
constructor( private logger: Logger ) {
this.logs = logger.allLogs();
}
示例3: express
import * as morgan from "morgan";
import * as Config from "config";
import { getInstance } from "./inversify.config";
import { Logger } from "logger";
import { IAPI } from "./api/IAPI";
let app: any = express(),
api: IAPI = getInstance<IAPI>("IAPI"),
loggerConfig: any = Config.get("logger"),
dbConfig: any = Config.get("mongodb"),
mongodb: Mongodb;
/**
* Initialize Logger
*/
Logger.init(loggerConfig);
/**
* Initialize Mongodb
*/
mongodb = new Mongodb(dbConfig);
mongodb.connect(
(error) => {
Logger.log(error);
}, () => {
Logger.log("Connected");
}
);
/** If the Node process ends, close the Mongoose connection */
process.on("SIGINT", () => {
示例4: function
Mongoose.connection.on("disconnected", function() {
Logger.info("Mongoose default connection disconnected");
});
示例5:
Mongoose.disconnect((err) => {
Logger.info(err);
});
示例6: toggleTodo
toggleTodo() {
this.todo.checked = !this.todo.checked;
this.logger.info( `'${this.todo.title}' ${this.todo.checked ? 'checked' : 'unchecked'}` );
}