💻 POAP - Logger📜
Intro
A logger with a simple facade to use in the POAP ecosystem.
Project
This project was built with Typescript.
Usage
Setup
Install from npm repository:
yarn add @poap-xyz/poap-logger
Logger Creation
Example usage with the Fastify onRequest hook:
export default function onRequest(this: FastifyInstance, request: FastifyRequest<any>, response: FastifyReply<any>, done: (err?: Error) => void) {
const logger = PoapLoggerFactory.createLoggerInstance({
metadata: {}
});
Where METADATA is a key value pair object where you add the properties you want to log, eg:
metadata: {
requestId: request.headers["requestid"],
requestUrl: request.url,
source: "POAP-Logger-Parent"
}
Child Loggers
Create a child logger to override or combine parent child metadata:
logger.child({
moreMetadata1: "More meta",
source: "POAP-Logger-Child"
});
Logger Types
Coming soon
Logger Transports
Coming soon
Active contributors
License
MIT © POAP