chore: format files using prettier (#7364)
* chore: format files using prettier * chore: api server files formatted
This commit is contained in:
parent
0225d806cc
commit
6ce700fd5d
149 changed files with 1518 additions and 919 deletions
|
|
@ -3,6 +3,7 @@
|
|||
This package provides a logger and a request logger utility built using [Winston](https://github.com/winstonjs/winston). It offers customizable log levels using env and supports structured logging for general application logs and HTTP requests.
|
||||
|
||||
## Features.
|
||||
|
||||
- Dynamic log level configuration using env.
|
||||
- Pre-configured winston logger for general usage (`logger`).
|
||||
- Request logger middleware that logs incoming request
|
||||
|
|
@ -10,7 +11,9 @@ This package provides a logger and a request logger utility built using [Winston
|
|||
## Usage
|
||||
|
||||
### Adding as a package
|
||||
|
||||
Add this package as a dependency in package.json
|
||||
|
||||
```typescript
|
||||
dependency: {
|
||||
...
|
||||
|
|
@ -20,11 +23,15 @@ dependency: {
|
|||
```
|
||||
|
||||
### Importing the Logger
|
||||
|
||||
```typescript
|
||||
import { logger, requestLogger } from '@plane/logger'
|
||||
import { logger, requestLogger } from "@plane/logger";
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
### `logger`: General Logger
|
||||
|
||||
Use this for general application logs.
|
||||
|
||||
```typescript
|
||||
|
|
@ -34,14 +41,16 @@ logger.error("This is an error");
|
|||
```
|
||||
|
||||
### `requestLogger`: Request Logger Middleware
|
||||
|
||||
Use this as a middleware for incoming requests
|
||||
|
||||
```typescript
|
||||
const app = express()
|
||||
app.use(requestLogger)
|
||||
const app = express();
|
||||
app.use(requestLogger);
|
||||
```
|
||||
|
||||
## Available Log Levels
|
||||
|
||||
- `error`
|
||||
- `warn`
|
||||
- `info` (default)
|
||||
|
|
@ -51,9 +60,11 @@ app.use(requestLogger)
|
|||
- `silly`
|
||||
|
||||
## Log file
|
||||
- Log files are stored in logs folder of current working directory. Error logs are stored in files with format `error-%DATE%.log` and combined logs are stored with format `combined-%DATE%.log`.
|
||||
|
||||
- Log files are stored in logs folder of current working directory. Error logs are stored in files with format `error-%DATE%.log` and combined logs are stored with format `combined-%DATE%.log`.
|
||||
- Log files have a 7 day rotation period defined.
|
||||
|
||||
## Configuration
|
||||
- By default, the log level is set to `info`.
|
||||
- You can specify a log level by adding a LOG_LEVEL in .env.
|
||||
|
||||
- By default, the log level is set to `info`.
|
||||
- You can specify a log level by adding a LOG_LEVEL in .env.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue