mirror of
https://github.com/gosticks/plane.git
synced 2025-10-16 12:45:33 +00:00
* feat: migrat to tsdown to tsup * fix: build scripts * fix: lock file fixes * fix: adding build process to i18n and propel packages * fix: lint warning * chore: update services module entry points * fix: lock file * fix: lock file * fix: remove tsc from build * fix: tsdown configs * fix: remove tsc step from build process --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> Co-authored-by: Aaron Reisman <aaron.reisman@plane.so> |
||
|---|---|---|
| .. | ||
| src | ||
| .eslintignore | ||
| .eslintrc.js | ||
| .prettierignore | ||
| .prettierrc | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
Logger Package
This package provides a logger and a request logger utility built using 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
Usage
Adding as a package
Add this package as a dependency in package.json
dependency: {
...
@plane/logger":"*",
...
}
Importing the Logger
import { logger, requestLogger } from "@plane/logger";
Usage
logger: General Logger
Use this for general application logs.
logger.info("This is an info log");
logger.warn("This is a warning");
logger.error("This is an error");
requestLogger: Request Logger Middleware
Use this as a middleware for incoming requests
const app = express();
app.use(requestLogger);
Available Log Levels
errorwarninfo(default)httpverbosedebugsilly
Log file
- Log files are stored in logs folder of current working directory. Error logs are stored in files with format
error-%DATE%.logand combined logs are stored with formatcombined-%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.