
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
ts-smart-logger
Advanced tools
An implementation of logger at TypeScript (TS 2 compatible).
First you need to install the npm module:
npm install ts-smart-logger --save
main.ts
import {LoggerFactory} from 'ts-smart-logger/index';
LoggerFactory.configure();
// or
LoggerFactory.configure({"logLevel": 3});
// or
LoggerFactory.configure(require('./config/log/default.json'));
// or
LoggerFactory.configure(require('./config/log/ProductionLoggerConfig').ProductionLoggerConfig);
LoggedFirstClass.ts
class LoggedFirstClass {
private logger:ILogger = LoggerFactory.makeLogger(LoggedFirstClass);
public logAtFirstClass() {
this.logger.info(1); // <=> console.info(1);
this.logger.warn(() => 2); // <=> console.warn(2);
this.logger.error(new Error("3")); // <=> console.error(new Error("3"));
this.logger.info(1, 2, 3); // <=> console.info(1, 2, 3);
this.logger.warn(() => [1, 2, 3]); // <=> console.warn([1, 2, 3]);
this.logger.error("Custom error:", new Error("2")); // <=> console.error("Custom error:", new Error("2"));
this.logger.debug((logger:IEnvironmentLogger) => {
// Here may be different kinds of complex calculations, performed only in logging mode
logger.write('Debug log mode enabled: ', 1, 2, 3); // <=> console.debug('Debug log mode enabled: ', 1, 2, 3);
});
this.logger.warn((logger:IEnvironmentLogger) => {
// Here may be different kinds of complex calculations, performed only in logging mode
logger.write('Warn log mode enabled: ', 1, 2, 3); // <=> console.warn('Warn log mode enabled: ', 1, 2, 3);
return [1, 2, 3].length; // <=> console.warn([1, 2, 3].length);
});
}
}
config.json
{
"debugLevelPath": "[0-9]+",
"infoLevelPath": ".",
"logLevelPath": ".",
"warnLevelPath": ".",
"errorLevelPath": "[^LoggedFirstClass]",
"logLevel": 3
}
Configure the runtime
$$LoggerFactory.storeConfig({"errorLevelPath": "[^Main]", "logLevel": 3})
Attention Since the "LoggerFactory" may be shared between the different dependencies we must include the script "npm dedupe" in this case into the package.json:
...
"scripts": {
"postinstall": "npm dedupe && ...",
},
...
npm run deploy
Licensed under MIT.
FAQs
An implementation of logger at TypeScript (TS 2 compatible).
The npm package ts-smart-logger receives a total of 215 weekly downloads. As such, ts-smart-logger popularity was classified as not popular.
We found that ts-smart-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.