You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@poap-xyz/poap-logger

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poap-xyz/poap-logger - npm Package Compare versions

Comparing version

to
1.6.0

2

package.json
{
"name": "@poap-xyz/poap-logger",
"version": "1.5.2",
"version": "1.6.0",
"description": "A logger for POAP",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

@@ -1,37 +0,39 @@

# 💻 POAP - Logger📜
# 💻 POAP Logger 📜
## Intro
A logger with a simple facade to use in the POAP ecosystem.
## Project
This project was built with Typescript.
## Usage
## Usage
### Setup
Install from npm repository:
Install from NPM repository:
```
yarn add @poap-xyz/poap-logger
```
### Logger Creation
Example usage with the Fastify onRequest hook:
```javascript
export default function onRequest(this: FastifyInstance, request: FastifyRequest<any>, response: FastifyReply<any>, done: (err?: Error) => void) {
const logger = PoapLoggerFactory.createLoggerInstance({
metadata: {/*METADATA*/}
});
import { PoapLoggerFactory } from '@poap-xyz/poap-logger';
const logger = PoapLoggerFactory.createLoggerInstance({
metadata: {/*METADATA*/}
});
```
Where METADATA is a key value pair object where you add the properties you want to log, eg:
Where METADATA is a key value pair object where you add extra properties you want to log, eg:
```javascript
metadata: {
const logger = PoapLoggerFactory.createLoggerInstance({
metadata: {
requestId: request.headers["requestid"],
requestUrl: request.url,
source: "POAP-Logger-Parent"
}
source: "POAP-Logger-Parent",
},
});
```
You can also use `getLoggerInstance` which will get a logger instance if one is already created or create a new one if not.
```javascript

@@ -44,17 +46,12 @@ PoapLoggerFactory.getLoggerInstance({

### Child Loggers
Create a child logger to override or combine parent child metadata:
```javascript
logger.child({
moreMetadata1: "More meta", //Will be added
source: "POAP-Logger-Child" //Will override parent's source prop
const newLogger = logger.child({
moreMetadata1: "More meta", // Will be added
source: "POAP-Logger-Child" // Will override parent's source prop
});
```
### Logger Types
Coming soon
### Logger Transports
Coming soon
## Active contributors

@@ -104,2 +101,3 @@ <!-- ALL-CONTRIBUTORS-LIST:END -->

## License
MIT © **[`POAP`](https://poap.xyz)**