Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@autoplay/workerlog
Advanced tools
A logging library for workers or servers.
✔ Colorful console logs
✔ CommonJS
✔ ES Modules
✔ TypeScript
We can create loggers which are essentially nested from their parent.
import { createWorkerLoggerProvider } from "@autoplay/workerlog";
// create logger provider
const provider = createWorkerLoggerProvider();
// root logger
const logger = provider.getLogger()
// create nested loggers
const appLogger = logger.named("App")
// create nested loggers with a name and a key
const pageLogger = appLogger.named("Page", page.id)
For example,
// now, any logs that `cssRenderHelpers` wants to surface, will go through `appLogger`
const cssLogger = appLogger.downgrade()
cssRenderHelpers.convertBezier(cssLogger, "...")
import { createWorkerLoggerProvider } from "@autoplay/workerlog";
// create logger provider
const provider = createWorkerLoggerProvider();
// set custom logging behaviors (filtering and such)
provider.configureLogging({
// disable style to the console (if the logger does not support style, this won't have an effect)
consoleStyle: false,
// configure the behavior of inclusion based on source of the logs
include(source) {
if (source.names.find(n => n.name === "XYZSystem")) {
// include internal logs for XYZSystem children
return {
internal: true
}
}
if (source.names.find(n => n.name === "Rendering")) {
// suppress all logs under the "Rendering" tree
return {
internal: false,
dev: false,
min: Infinity,
}
}
if (source.names.find(n => n.name === "Page" && n.key === "page_ajkwhloieuw8990se")) {
// enable all logs for page "page_ajkwhloieuw8990se"
// this source would have been constructed via something like `parentLogger.named("Page", page.id)`
return {
internal: true,
min: 0,
}
}
},
});
import { createWorkerLoggerProvider, WorkerLoggerLevel } from "@autoplay/workerlog";
// create logger provider
const logger = createWorkerLoggerProvider();
// set a custom console
logger.configureLogger({
type: "console",
console: console,
// disable colorful styling
style: false,
});
// disable console styling, and set default console
logger.configureLogger({
type: "console",
style: false,
});
// set your own keyed logger
logger.configureLogger({
type: "keyed",
keyed(nameAndKeys) {
const prefix = nameAndKeys
.map((a) => (a.key ? `${a.name}#${a.key}` : a.name))
.join(" ");
return {
error(meta, message, args) {
console.error(
meta.category,
WorkerLoggerLevel[meta.level],
prefix,
message,
...(args ? [args] : [])
);
},
warn(meta, message, args) {
console.warn(
meta.category,
WorkerLoggerLevel[meta.level],
prefix,
message,
...(args ? [args] : [])
);
},
debug(meta, message, args) {
console.info(
meta.category,
WorkerLoggerLevel[meta.level],
prefix,
message,
...(args ? [args] : [])
);
},
trace(meta, message, args) {
console.debug(
meta.category,
WorkerLoggerLevel[meta.level],
prefix,
message,
...(args ? [args] : [])
);
},
};
},
});
This project is licensed under the terms of the MIT license.
FAQs
A flexible logger for workers.
The npm package @autoplay/workerlog receives a total of 0 weekly downloads. As such, @autoplay/workerlog popularity was classified as not popular.
We found that @autoplay/workerlog 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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.