You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varlog4bro=require("log4bro");varoptions={"productionMode": false,"logDir": "logs","skipEnhance": true,"namespace": "","silence": false,"loggerName": "dev","dockerMode": false,"varKey": "MLOG"};varlogger=newlog4bro(options);varmsg="ich mache mir sorgen, ob der logger denn noch funktioniert.";MLOG.trace(msg);MLOG.debug(msg);MLOG.info(msg);MLOG.warn(msg);MLOG.error(msg);MLOG.fatal(msg);MLOG.info(options);console.log("");/* json style */varoptions2={"productionMode": true,"logDir": "logs","skipEnhance": true,"namespace": "","silence": false,"loggerName": "dev","dockerMode": true,"varKey": "JLOG","logFieldOptions": {"log_type": "application","application_type": "service","service": "bro-service"}};varlogger2=newlog4bro(options2);JLOG.trace(msg);JLOG.debug(msg);JLOG.info(msg);JLOG.warn(msg);JLOG.error(msg);JLOG.fatal(msg);JLOG.error(options2);
auto express.js access log logging
varexpress=require("express");varlog4bro=require("./../../index.js");varoptions={"productionMode": false,"logDir": "logs","skipEnhance": true,"namespace": "","silence": false,"loggerName": "dev","dockerMode": true,"varKey": "MLOG","level": "DEBUG","serviceName": "cool-service"};varlogger=newlog4bro(options);varapp=express();// log an elk formatted access log to coutlogger.applyMiddlewareAccessLog(app);// pass morgan options// for example [skip option](https://github.com/expressjs/morgan#skip): only log error responseslogger.applyMiddlewareAccessLog(app,undefined,{skip: function(req,res){returnres.statusCode<400;}});//log an elk formatted access log to a filelogger.applyMiddlewareAccessLogFile(app,"./access_log.json");