
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
Isomorphic logger wrapper.
同构日志打印适配器。
In experimental stage.
试验阶段。
If you have made some relative large apps, you will find logging & monitoring are important parts.
如果你写过相对比较复杂的业务,会发现日志、埋点是不可缺少的部分。
Since code quality can be influenced by different reasons, sometimes the only controlled part is logging, it's important to add some logs to your app.
因为代码本身质量受各种因素影响,再不加日志排查的话,后果不堪设想。
However there may be many conditions of logging itself:
但是日志有非常多种情况:
These different conditions could use different library, or even in different devices. Every collaborator may have his thought. Finally the code becomes messy.
这些不同的组合可能会调用不同的库,甚至还可能会跨端(多谢小程序),每个人有不同的想法,最终会将代码搅成一锅粥。
If someone does some impilicit encapsulation of logging, it will be hard for new collaborator to understand what happens of the logging code snippet.
如果有人又做了一些隐式的封装,那么事情会变得更难收场,新加入的人会更难理解这段日志打印究竟做了啥。
So I try to merge those conditions in one adapter. At least I hope it can meet most demands.
所以我试图把这些概念通过适配层集中然后抹平,至少要适应多数业务场景。
import { ilw } from "ilw";
const logger = ilw({
// unified logging entry
// 统一的日志调用出口
// report - Whether to report
// 是否上报
// persist - Whether to persist data
// 是否持久化
// type - type, may be 'plain' or 'event'
// 类型,可以是 'plain' 或者 'event'
// meta - Meta message, anything
// 额外信息,随便放
onLog(level, messages, { report, persist, type, meta }) {
if (report) {
// Maybe your company's monitoring library
// 可以是你公司的埋点工具
if (type === "event") {
// report by eventName & params
// 以事件名,事件信息的方式上报
eventReporter.report(messages[0], messages[1]);
} else {
// report by string
// 以字符串形式上报
eventReporter.report(message.map(JSON.stringify).join(","));
}
} else if (persist) {
// Maybe your company's client logging SDK
// 可以是你公司的客户端日志 SDK,比如通过小程序写入客户端
nativeLogger(...messages);
} else {
// Or just print normally.
// 走一波正常的日志打印
console[level](...messages);
}
},
});
// report 上报
logger.report.info("xxx", "yyy");
// persist 持久化
logger.persist.info("xxx", "yyy");
// event type 事件格式
logger.event.info("eventName", {});
// Meta
logger.meta({ foo: "bar" }).info("xxx");
// any combinations 随意组合
logger.persist.report.info("xx", "yyy");
// Use it like currify a function
// 也可以利用类似柯里化的方式
const persistLogger = logger.persist;
persistLogger.info("xxx", "yyy");
const operationLogger = logger.meta({ scope: "operation" });
operationLogger.error("oops", new Error());
FAQs
Isomorphic logger wrapper
The npm package ilw receives a total of 0 weekly downloads. As such, ilw popularity was classified as not popular.
We found that ilw 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.