probot
Version:
A framework for building GitHub Apps to automate and improve your workflow
34 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLog = getLog;
/**
* A logger backed by [pino](https://getpino.io/)
*
* The default log level is `info`, but you can change it passing a level
* string set to one of: `"trace"`, `"debug"`, `"info"`, `"warn"`,
* `"error"`, or `"fatal"`.
*
* ```js
* app.log.debug("…so is this");
* app.log.trace("Now we're talking");
* app.log.info("I thought you should know…");
* app.log.warn("Woah there");
* app.log.error("ETOOMANYLOGS");
* app.log.fatal("Goodbye, cruel world!");
* ```
*/
const pino_1 = require("pino");
const pino_2 = require("@probot/pino");
const rebind_log_js_1 = require("./rebind-log.js");
function getLog(options = {}) {
const { level, logMessageKey, ...getTransformStreamOptions } = options;
const pinoOptions = {
level: level || "info",
name: "probot",
messageKey: logMessageKey || "msg",
};
const transform = (0, pino_2.getTransformStream)(getTransformStreamOptions);
transform.pipe(pino_1.pino.destination(1));
return (0, rebind_log_js_1.rebindLog)((0, pino_1.pino)(pinoOptions, transform));
}
//# sourceMappingURL=get-log.js.map