
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
github.com/CaledoniaProject/gopkg-lumberjack
If you have a multi-goroutine program where each goroutine uses Lumberjack for log rotation, the official repo may experience a memory leak. A fix was proposed years ago, but the pull request was never accepted. As a result, I'm creating my own repo to resolve this issue more quickly.
You can retrieve a rotating log handler like this, using the power of the Logrus library:
import (
lumberjack "github.com/CaledoniaProject/gopkg-lumberjack"
)
func GetTTYFormatter() *logrus.TextFormatter {
return &logrus.TextFormatter{
TimestampFormat: "2006-01-02 15:04:05",
DisableColors: false,
ForceColors: true,
FullTimestamp: true,
CallerPrettyfier: func(f *runtime.Frame) (string, string) {
return "", fmt.Sprintf("[%s:%d]", path.Base(f.File), f.Line)
},
}
}
func GetRotatingFileLogger(filename string) (*logrus.Logger, *lumberjack.Logger) {
lumberjack_logger := &lumberjack.Logger{
Filename: filename,
MaxSize: 200,
MaxBackups: 20,
MaxAge: 7,
Compress: true,
}
logger := &logrus.Logger{
Out: lumberjack_logger,
Formatter: GetTTYFormatter(),
ReportCaller: true,
Level: logrus.InfoLevel,
}
return logger, lumberjack_logger
}
FAQs
Unknown package
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
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.