本文整理汇总了TypeScript中da-helpers.logger.LoggerCompose类的典型用法代码示例。如果您正苦于以下问题:TypeScript logger.LoggerCompose类的具体用法?TypeScript logger.LoggerCompose怎么用?TypeScript logger.LoggerCompose使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了logger.LoggerCompose类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
//get initialization parameters from env, docker env parameters have priority
var rabbitUrl = process.env.RABBITMQ_PORT_5672_TCP_ADDR ? "amqp://#{process.env.RABBITMQ_PORT_5672_TCP_ADDR}:#{process.env.RABBITMQ_PORT_5672_TCP_PORT}" : process.env.RABBITMQ_URI;
var rabbitQueue = process.env.RABBITMQ_QUEUE;
var pubHub = new pubSub.PubSubRabbit();
var mongoUrl = process.env.MONGO_PORT_27017_TCP_ADDR ?
"mongodb://#{process.env.MONGO_PORT_27017_TCP_ADDR}:#{process.env.MONGO_PORT_27017_TCP_PORT}" :
process.env.MONGO_LOG_URI;
var log = new logger.LoggerCompose(
{pack: require("../package.json"), tags: ["trader"]},
{
loggly: {token: process.env.LOGGLY_KEY, subdomain: process.env.LOGGLY_SUBDOMAIN},
mongo: {connection: mongoUrl, collection: process.env.MONGO_LOG_COLLECTION},
console: true
}
);
log.write({oper: "app_start", status: "success"});
var promise = Promise.resolve();
promise.then(() => {
pubHub.connect({
uri: rabbitUrl,
queue: rabbitQueue,
type: pubSub.PubSubTypes.pub
});
}
示例2:
}, (err) => {
log.write({oper: "amqp_connected", status: "error", error: err, queue: rabbitQueue, type : "pub"});
}
示例3:
).then(() => {
log.write({oper: "amqp_connected", status: "success", queue: rabbitQueue});
}, (err) => {
示例4: onHandle
function onHandle(cmd) {
if (cmd.extit) onExit(cmd);
log.write({oper: "handle", status: "start", cmd: cmd});
//insert you handle logic here
handler.handle(null);
}
示例5: onExit
function onExit(res) {
log.write({oper: "app_stop", status: "success", res: res});
subHub.close();
}