ZaneRay Express Logging
Structured logging in all environments
Definitions
Environments
Log Levels - from Winston
- 0: error
- 1: warn
- 2: info
- 3: verbose
- 4: debug
- 5: silly
Usage
// in your code.js
const Logging = require("@zaneray/express-logging");
// set process.env.NODE_ENV in the runtime
// logger level and output method is determined by environment (see transports.js and options.js)
const logging = new Logging();
//pass the logging level in the getLogger method
const logger = logging.getLogger();
// Writes some log entries
logger.error("warp nacelles offline");
logger.info("shields at 99%");
API
POST /addPledge
- request.body={"email": "jonkofal@zaneray.com","bags": 5,"ipaddress": "66.135.64.2","location": {"_latitude": 47, "_longitude": 320 }}
- responses
- 200 - irrelevant
- 500 - invalid data, nasty HTML error
GET /coordinates
- responses
- 200 - [ {"_longitude": 320,"_latitude": 47}, {"_latitude": 33,"_longitude": 220}]
GET /bagCount