
Research
Shai-Hulud Descends to Hades: Miasma Worm Campaign Spreads with New PyPI Wave
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.
@decaf-ts/logging
Advanced tools
Decaf’s logging toolkit keeps one fast MiniLogger at the core while exposing adapters, filters, and utilities that fit both browser and Node.js runtimes:
Logging.setConfig or the Environment accumulator and let impersonated child loggers inherit overrides without allocations.LoggingConfig contract.LoggedClass, and Logging.because while StopWatch, text/time utilities, and environment helpers round out the diagnostics surface.Logging: A static class for managing global logging configuration and creating logger instances.MiniLogger: A lightweight, default logger implementation.LoggedClass: An abstract base class that provides a pre-configured logger instance to its subclasses.LoggedEnvironment: A class for managing environment-specific logging configurations.@log, @benchmark, etc.) for easily adding logging and benchmarking to your methods.
Documentation available here
Minimal size: 7.4 KB kb gzipped
The logging package is a lightweight, extensible logging solution for TypeScript projects. It centers on two main constructs:
It also offers:
Core files and their roles
src/types.ts: Type definitions and contracts
src/constants.ts: Defaults and enums
src/logging.ts: Implementations and static facade
src/decorators.ts: Method decorators
src/LoggedClass.ts: Base convenience class
src/winston/winston.ts: Optional Winston adapter
Design principles
Key behaviors
Public API surface
Intended usage
This guide provides examples of how to use the main features of the @decaf-ts/logging library.
You can set the initial logging configuration using Logging.setConfig().
import { Logging, LogLevel } from '@decaf-ts/logging';
Logging.setConfig({
level: LogLevel.debug,
style: true,
timestamp: true,
});
The logging framework uses a proxy-based impersonation mechanism to create child loggers. This provides a significant performance gain by avoiding the need to create new logger instances for each context.
import { Logging } from '@decaf-ts/logging';
const rootLogger = Logging.get();
const childLogger = rootLogger.for('MyClass');
// childLogger is a proxy that inherits the configuration of rootLogger
childLogger.info('This is a message from the child logger');
Filters allow you to process log messages before they are written. You can use them to filter out sensitive information.
import { Logging, PatternFilter } from '@decaf-ts/logging';
// Filter out passwords
const passwordFilter = new PatternFilter(/password/i, '********');
Logging.setConfig({
filters: [passwordFilter],
});
const logger = Logging.get();
logger.info('User logged in with password: mysecretpassword');
// Output will be: User logged in with password: ********
Transports are responsible for writing log messages to a destination. The library includes a default console transport, and you can create your own.
Note: The library currently focuses on filters and logger implementation, with transport-like functionality being a feature of the underlying adapters (Pino, Winston).
The library includes built-in support for Pino and Winston.
import { Logging } from '@decaf-ts/logging';
import { pino } from 'pino';
import { PinoLogFactory } from '@decaf-ts/logging/pino';
const pinoInstance = pino();
Logging.setFactory(new PinoLogFactory(pinoInstance));
const logger = Logging.get();
logger.info('This message will be logged by Pino');
import { Logging } from '@decaf-ts/logging';
import * as winston from 'winston';
import { WinstonLogFactory } from '@decaf-ts/logging/winston';
const winstonInstance = winston.createLogger({
transports: [new winston.transports.Console()],
});
Logging.setFactory(new WinstonLogFactory(winstonInstance));
const logger = Logging.get();
logger.info('This message will be logged by Winston');
LoggedEnvironmentThe LoggedEnvironment class allows you to manage environment-specific logging configurations.
import { LoggedEnvironment } from '@decaf-ts/logging';
// Set the application name
LoggedEnvironment.app = 'MyAwesomeApp';
// Accumulate additional environment configuration
LoggedEnvironment.accumulate({
database: {
host: 'localhost',
port: 5432,
},
});
LoggedClassThe LoggedClass is an abstract base class that provides a pre-configured logger instance to its subclasses.
import { LoggedClass } from '@decaf-ts/logging';
class MyService extends LoggedClass {
doSomething() {
this.log.info('Doing something...');
}
}
const service = new MyService();
service.doSomething();
The library provides a set of decorators for easily adding logging and benchmarking to your methods.
@logimport { log, LogLevel } from '@decaf-ts/logging';
class MyDecoratedService {
@log(LogLevel.info)
myMethod(arg1: string) {
// ...
}
}
@benchmarkimport { benchmark } from '@decaf-ts/logging';
class MyBenchmarkedService {
@benchmark()
myLongRunningMethod() {
// ...
}
}
If you have bug reports, questions or suggestions please create a new issue.
I am grateful for any contributions made to this project. Please read this to get started.
The first and easiest way you can support it is by Contributing. Even just finding a typo in the documentation is important.
Financial support is always welcome and helps keep both me and the project alive and healthy.
So if you can, if this project in any way. either by learning something or simply by helping you save precious time, please consider donating.
This project is released under the MIT License.
By developers, for developers...
FAQs
simple winston inspired wrapper for cross lib logging
The npm package @decaf-ts/logging receives a total of 612 weekly downloads. As such, @decaf-ts/logging popularity was classified as not popular.
We found that @decaf-ts/logging demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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 found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.