本文整理汇总了TypeScript中log4js.getLogger函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getLogger函数的具体用法?TypeScript getLogger怎么用?TypeScript getLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLogger函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: errorLog
/**
* エラー内容をファイルに記述
* @param err {String}エラー内容
*/
static errorLog(err: string) {
//ログ出力設定ファイル、log_config.jsonの読み込み
log4js.configure(__dirname + '/log_config.json');
//ロガー取得
const errorLogger = log4js.getLogger('error');
errorLogger.error(err);
}
开发者ID:Huruikagi,项目名称:Meshinator,代码行数:11,代码来源:ControlLog.ts
示例2: init
export function init(logger?, name = 'eip') {
if (logger) {
Logger = logger;
} else {
Logger = log4js.getLogger(`[${name}]`);
}
}
开发者ID:Workable,项目名称:aggregator-eip,代码行数:7,代码来源:logger.ts
示例3: toArray
export function toArray(
callback: (doneChannels: ch.DoneChannel[]) => void ): void {
var logger = log4js.getLogger('app');
connect((err, db) => {
if (err != null) {
logger.error(err);
callback(null);
return;
}
db.collection('doneChannels', (err, collection) => {
if (err != null) {
logger.error(err);
callback(null);
return;
}
collection.find().sort({ end: -1 }).toArray((err, doneChannels: ch.DoneChannel[]) => {
if (err != null) {
logger.error(err);
callback(null);
return;
}
db.close(true);
callback(doneChannels);;
});
});
});
}
开发者ID:At-sushi,项目名称:developersyp,代码行数:27,代码来源:database.ts
示例4: setup
function setup(app: express.Express) {
// View engine setup
app.set("views", path.join(__dirname, "/../views"));
app.set("view engine", "pug");
// uncomment after placing your favicon in /public
// app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
// Body parser setup
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
// Cookie parser setup
app.use(cookieParser());
// Log4js setup
app.use(log4js.connectLogger(log4js.getLogger("http"), { level: "auto" }));
// Passport setup when using
// app.use(setupedPassport.initialize());
// app.use(setupedPassport.session());
// Static dir setup
app.use(express.static(path.join(__dirname, "/../public")));
// Rooting setup
setupRoutes(app);
app.use((req, res, next) => {
const err = new HttpErrors.NotFound();
next(err);
});
app.use((err: Error, req, res, next) => {
const error = err as HttpErrors.HttpError;
res.status(error.status || 500);
const params = {
error: (process.env.NODE_ENV !== "production") ? error : null,
message: error.message
};
if (/^\/api/.test(req.originalUrl)) {
res.send(params);
} else {
res.render("error", params);
}
});
}
开发者ID:AKIRA-MIYAKE,项目名称:Typeyard,代码行数:52,代码来源:index.ts
示例5: execute
function execute(ipaddress: string, port: number, rootIp:string, rootPort: number, dbAddress:string, publicPath: string) {
var logger = log4js.getLogger('app');
var app = express();
routes.rootServerIndexRepository = new rootserver.RootServerIndexRepository(rootIp, rootPort);
db.address = dbAddress;
app.configure(() => {
app.use((req, res, next) => {
logger.info([
req.headers['x-forwarded-for'] || req.client.remoteAddress,
new Date().toLocaleString(),
req.method,
req.url,
res.statusCode,
req.headers.referer || '-',
req.headers['user-agent'] || '-'
].join('\t'));
next();
});
app.use(express.favicon());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(publicPath));
app.use((req, res) => {
res.sendfile(publicPath + '/partials/layout.html');
});
for (var dirPath in routes.routings) {
app.get(dirPath, routes.routings[dirPath]);
}
});
app.configure('development', () => {
app.use(express.logger('dev'));
app.use(express.errorHandler());
});
var server = http.createServer(app);
var ws = io.listen(server, { 'log level': 1 }, () => { });
ws.on('connection', socket => {
new routes.WebSocket(socket);
});
server.listen(port, ipaddress, null, function () {
logger.info("Express server listening on port " + port);
});
}
开发者ID:At-sushi,项目名称:developersyp,代码行数:50,代码来源:server.ts
示例6: init
static init(config: any, app: express.Application): any {
var log4js: any = require('log4js');
log4js.configure('config/log4js_setting.json');
var logger = log4js.getLogger('app');
logger.setLevel(config.log.level); // ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
logger.info('Logging start. ');
logger.info('Log Level:' + config.log.level);
app.use(log4js.connectLogger(logger, {
level: config.log.level
}));
return logger;
}
开发者ID:masahirompp,项目名称:chords,代码行数:14,代码来源:Logger.ts
示例7: add
export function add(channel: ch.DoneChannel) {
var logger = log4js.getLogger('app');
connect((err, db) => {
if (err != null) {
logger.error(err);
return;
}
db.collection('doneChannels', (err, collection) => {
var old = new Date();
old.setDate(old.getDate() - 15);
collection.findAndRemove({
end: { $lt: old }
}, (err, line) => {// ついでに古いものを削除
if (err != null) {
logger.error(err);
}
if (line > 0) {
logger.info(line + ' doneChannel(s) deleted.');
}
}); // deleteは並列実行
collection.findAndRemove({
'channel.id': channel.channel.id,
end: { $gt: channel.begin }// > grater than 配信開始より後の時間に終了しているチャンネル
}, (err, line) => {// ネットワークトラブルとかで配信中にチャンネル終了扱いされちゃう場合に、直前の誤検出を削除する
if (err != null) {
logger.error(err);
}
if (line > 0) {
logger.info(line + ' doneChannel(s) deleted.');
}
}); // deleteは並列実行
collection.insert(channel, err => {
if (err != null) {
logger.error(err);
}
db.close(true);
});
});
});
}
开发者ID:At-sushi,项目名称:developersyp,代码行数:41,代码来源:database.ts
示例8:
module.exports = (name = 'coc-nvim'): log4js.Logger => {
return log4js.getLogger(name)
}
开发者ID:demelev,项目名称:coc.nvim,代码行数:3,代码来源:logger.ts
示例9: express
import * as bodyParser from "body-parser";
import * as express from "express";
import * as http from "http";
import * as log4js from "log4js";
import * as morgan from "morgan"; // Logging middleware
import * as path from "path";
import * as uuid from "uuid";
import { default as configManager } from "./conf";
//import routes from "./routes";
log4js.configure(path.join(__dirname, "..", "log4js.config.json"));
const log = log4js.getLogger("main");
log.info("Initializing application...");
const app = express();
{ // Implement shutdown link. The application will exit by GET request to /shutdown
const isAllowedShutdowLink: boolean = configManager.getEnabled("server.shutdownlink");
if (isAllowedShutdowLink) {
log.info("Apply /shutdown link");
app.use(bodyParser.urlencoded({ extended: false }));
const shutdownKey = uuid.v1();
app.get("/shutdown", function (req: express.Request, res: express.Response): any {
return res
.header("Content-Type: text/html")
.send("<form method='POST'>"
+ "<input type='hidden' name='key' value='" + shutdownKey + "'>"
+ "<input type='submit' value='Shutdown'>"
开发者ID:theanurin,项目名称:tagfs,代码行数:31,代码来源:server.ts
示例10: requestHTTP
import http from 'http';
import log4js from 'log4js';
import PCPSocket from './applications/PCPSocket';
const logger = log4js.getLogger();
export {
PCPSocket,
};
export async function requestHTTP(options: http.RequestOptions) {
return new Promise<{ statusCode: number; socket: PCPSocket }>((resolve, reject) => {
if (options.headers == null) {
options.headers = {};
}
options.headers['x-peercast-pcp'] = 1;
// options.headers['x-peercast-pos'] = 0;
// options.headers['x-peercast-port'] = 7145;
try {
http.request(options, (res) => {
logger.debug('res');
resolve({
statusCode: res.statusCode!,
socket: new PCPSocket(res.socket, false),
});
}).end();
} catch (e) {
console.error(e.stack);
}
});
}
开发者ID:progre,项目名称:pcp,代码行数:31,代码来源:pcp.ts
注:本文中的log4js.getLogger函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论