https://github.com/a-pankif/eventstorage
Eventstorage - this is an event logger with high-speed recording and event reading capability for golang applications. Supports log rotation.
https://github.com/a-pankif/eventstorage
eventlog eventlogger exchange go golang golang-library logger logrotate readlog
Last synced: 3 months ago
JSON representation
Eventstorage - this is an event logger with high-speed recording and event reading capability for golang applications. Supports log rotation.
- Host: GitHub
- URL: https://github.com/a-pankif/eventstorage
- Owner: a-pankif
- License: mit
- Created: 2022-05-07T15:28:56.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-25T11:55:02.000Z (almost 4 years ago)
- Last Synced: 2026-01-15T07:30:18.799Z (5 months ago)
- Topics: eventlog, eventlogger, exchange, go, golang, golang-library, logger, logrotate, readlog
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Eventstorage

[](https://goreportcard.com/report/github.com/pankif/eventstorage)
[](https://github.com/pankif/eventstorage/blob/main/LICENSE)
Eventstorage - this is an event logger with high-speed recording and event reading capability. Supports log rotation.
Well suited for tasks where you need to make a lot of writes (tens of thousands per second) and sometimes read them
for transmission somewhere. For example, to exchange data between several applications, storages, clusters, etc.
## Benchmarks
```console
cpu: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
BenchmarkWriteChar-16 63323869 19.42 ns/op 4 B/op 0 allocs/op
BenchmarkEventStorage_ReadChar-16 323152 3665 ns/op 24 B/op 1 allocs/op
BenchmarkEventStorage_CharReadTo-16 331111 3637 ns/op 8 B/op 1 allocs/op
BenchmarkEventStorage_CharReadToOffset10000-16 43273 27300 ns/op 8 B/op 1 allocs/op
````
## Installation
```
go get -u github.com/pankif/eventstorage
```
## Examples
```go
package main
import (
"fmt"
"time"
"github.com/pankif/eventstorage"
)
func main() {
storage, err := eventstorage.New("./")
defer storage.Shutdown()
if err != nil {
fmt.Println(err)
return
}
storage.SetWriteFileMaxSize(10 * eventstorage.MB)
storage.SetAutoFlushCount(1)
_ = storage.SetAutoFlushTime(60 * time.Millisecond)
_, _ = storage.Write([]byte("some data to write"))
fmt.Println(storage.Read(1, 0))
}
```
More examples you can find into [here](https://github.com/pankif/eventstorage/tree/main/examples).
## Tests
- Coverage percent `go test ./... -coverprofile=coverage.out && go tool cover -func=coverage.out`
- Coverage map `go test ./ -coverprofile c.out && go tool cover -html=c.out`
- `go test -bench=. --benchmem`
- `go test -bench=BenchmarkWriteChar -benchmem -cpuprofile profile.out`
- `go test -bench=BenchmarkWriteChar -benchmem -memprofile profile.out`
- `go tool pprof profile.out`
```console
github.com/pankif/eventstorage 0.162s coverage: 95.0% of statements
````