jukkahell / nestlogger Goto Github PK
View Code? Open in Web Editor NEWLogger library for NestJs services
Logger library for NestJs services
I found that warning, when i run npm audit command!
Does is critical?
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Incorrect Comparison in axios │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ axios │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=0.21.2 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ nest-logger │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ nest-logger > @nestjs/common > axios │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ GHSA-cph5-m8f7-6c5x │
└───────────────┴──────────────────────────────────────────────────────────────┘
Currently logging Map entries prints only {}. Should print key-value-pairs.
I just tried to extend your module with a level
option for transports, which winston apparently supports.
Quickly found out that neither console
nor rotate
actually pass the supplied options to winston's transport constructors.
In case of console
it's just empty:
public static console(options?: LoggerOptions): ConfiguredTransport {
...
const transport = new winston.transports.Console();
...
}
In case of rotate
some explicitly specified options are passed, the rest is discarded?
public static rotate(options?: LoggerOptions): ConfiguredTransport {
const defaultOptions = Object.assign({}, LoggerService.DEFAULT_LOGGER_OPTIONS);
const fileLoggerOptions = Object.assign(defaultOptions, options);
const transport = new DailyRotateFile({
...
maxFiles: fileLoggerOptions.maxFiles,
options: { flags: "a", mode: "0776" },
});
return { transport, options: fileLoggerOptions };
}
Is there something I'm missing? For example, shouldn't console
look something like the following?
public static console(options?: LoggerOptions): ConfiguredTransport {
const defaultOptions = Object.assign({}, LoggerService.DEFAULT_LOGGER_OPTIONS);
const consoleLoggerOptions = Object.assign(defaultOptions, options);
const transport = new winston.transports.Console(consoleLoggerOptions);
return { transport, options: consoleLoggerOptions };
}
Hi,
Thanks for this great library.
I hope if I can use LoggerService as an Interceptor for logging incoming Http Requests. Is there any built-in functionality for that purpose?
something like morgan
Hi,
is there a way to add multiple log levels to a single logger? something like this:
const logger = new LoggerService( 'info error warning', loggers, );
export class SecurityService {
constructor(
private readonly logger: LoggerService
) {
this.logger.setContext(`SecurityService`);
}
}
export class SecurityService1 {
constructor(
private readonly logger: LoggerService
) {
this.logger.setContext(`SecurityService1`);
}
}
it alway get context is SecurityService
Hi Can you please add an example how to import the LoggerService in any controller or service ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.