
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
github.com/tj/go-cli-analytics
Disk-buffered analytics for CLI tools powered by Segment. Analytics for CLI tools can help determine which aspects of your tool are most valued by users, and where improvements could be made. Track command or flag usage, errors, latencies, or others, just don't be sketchy!
Pass your Segemnt write key, and specify a directory name which will reside in HOME.
a := analytics.New(&analytics.Config{
WriteKey: "<write key>",
Dir: ".myprogram",
})
This package will create three files:
Track events like this:
a.Track("More Something", map[string]interface{}{
"other": "stuff",
"whatever": "else here",
})
Flush events at random, based on the previous duration time, or based on size. Note that flushing on every command will introduce ~500ms of latency, so don't do this.
lastFlush, _ := a.LastFlush()
n, _ := a.Size()
switch {
case n >= 15:
fmt.Printf(" flush due to size\n")
a.Flush()
case time.Now().Sub(lastFlush) >= time.Minute:
fmt.Printf(" flush due to duration\n")
a.Flush()
default:
fmt.Printf(" close\n")
a.Close()
}
Note that there is no file-level locking at the moment for concurrent executions of your program. This may be added in the future if necessary.
tjholowaychuk.com · GitHub @tj · Twitter @tjholowaychuk
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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.