
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@wiredcraft/nestjs-bunyan-logger
Advanced tools
A logger module for [Nestjs](https://github.com/nestjs/nest), built on top of [node-bunyan](https://github.com/trentm/node-bunyan).
A logger module for Nestjs, built on top of node-bunyan.
request-id
, timestamp
, status-code
, etc.yarn add @wiredcraft/nestjs-bunyan-logger
npm install @wiredcraft/nestjs-bunyan-logger --save
LoggerModule
in the root App module, this provides initialized bunyan logger instance that is available to other modules by injection.import { Module } from '@nestjs/common';
import { LoggerConfig, LoggerModule } from '@wiredcraft/nestjs-bunyan-logger';
import configuration from './src/configuration';
@Module({
imports: [
ConfigModule.forRoot({
load: [configuration],
}),
LoggerModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => {
return configService.get<LoggerConfig>('logger', { infer: true });
},
inject: [ConfigService],
}),
],
})
export class AppModule {}
A sample configuration file is as below,
export default () => ({
logger: {
name: 'awesome-app',
streamType: 'FILE' | 'STDOUT',
path: './logs/app.log', // only available for `FILE` streamType
excludeReqPath: '/health', // the path that you want to skip logging
},
});
import { Injectable } from '@nestjs/common';
import { Logger, Bunyan } from '@wiredcraf/nestjs-bunyan-logger';
@Injectable()
export class CatService {
constructor(@Logger() private logger: Bunyan) {}
}
transformers
is a config option that could allow the user to specify a list of customized transform rules to apply to each log entry. The current library supports three types of transformers: constant
, clone
and map
.
constant
type allows the user to copy a object type constant directly to the log entry. An example is as follows:
const options: LoggerConfig = {
name: 'test-app',
streamType: 'STDOUT',
transformers: [{ constant: { customField: '123' } }],
};
logger.info({ originalField: 'abc' });
// The above will generate the following log entry:
// {
// originalField: 'abc',
// customField: '123'
// }
clone
type allows the user to copy value from one fieldname to the specified fieldname with the following rules:
An example is as follows:
const options: LoggerConfig = {
name: 'test-app',
streamType: 'STDOUT',
transformers: [{ clone: { originalField: 'newField' } }],
};
logger.info({ originalField: 'abc' });
// The above will generate the following log entry:
// {
// originalField: 'abc',
// newField: 'abc'
// }
An one embed level example is as follows:
const options: LoggerConfig = {
name: 'test-app',
streamType: 'STDOUT',
transformers: [{ clone: { originalField: 'newParent.newField' } }],
};
logger.info({ originalField: 'abc' });
// The above will generate the following log entry:
// {
// originalField: 'abc',
// newParent: {
// {
// newField: 'abc'
// }
// }
// }
map
type allows the user to apply a map value or a map function to the target field and replace the field value with the mapped value with the following rules:
An example of simple map value is as follows:
const options: LoggerConfig = {
name: 'test-app',
streamType: 'STDOUT',
transformers: [{ map: { originalField: 'new-value' } }],
};
logger.info({ originalField: 'abc' });
// The above will generate the following log entry:
// {
// originalField: 'new-value',
// }
An example of map function is as follows:
const options: LoggerConfig = {
name: 'test-app',
streamType: 'STDOUT',
transformers: [
{ map: { originalField: (oldValue) => oldValue + 'transformed' } },
],
};
logger.info({ originalField: 'abc' });
// The above will generate the following log entry:
// {
// originalField: 'abctransformed',
// }
An one embed level example is as follows:
const options: LoggerConfig = {
name: 'test-app',
streamType: 'STDOUT',
transformers: [
{ map: { ['originalParentField.originalField']: 'new-value' } },
],
};
logger.info({
originalParentField: {
originalField: 'abc',
},
});
// The above will generate the following log entry:
// {
// originalParentField: {
// originalField: 'new-value',
// },
// }
Multiple transformers are applied in the order as they are specified in the transformers
option. An example is as follows:
const transformers = [
{
constant: { customField: 'custom-value' },
},
{
clone: { originalField: 'backupField' },
},
{
map: { originalField: (oldValue) => oldValue + 'transformed' },
},
];
const options: LoggerConfig = {
name: 'test-app',
streamType: 'STDOUT',
transformers,
};
logger.info({ originalField: 'original-value' });
// The above will generate the following log entry:
// {
// originalField: 'original-value-transformed',
// backupField: 'original-value',
// customField: 'custom-value'
// }
$ npm install
$ npm version major|minor|patch
$ npm publish
FAQs
A logger module for [Nestjs](https://github.com/nestjs/nest), built on top of [node-bunyan](https://github.com/trentm/node-bunyan).
The npm package @wiredcraft/nestjs-bunyan-logger receives a total of 13 weekly downloads. As such, @wiredcraft/nestjs-bunyan-logger popularity was classified as not popular.
We found that @wiredcraft/nestjs-bunyan-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.