# README
stat
Statistics on system and process cpu and memory information, alarm notification support.
Example of use
import "github.com/go-dev-frame/sponge/pkg/stat"
l, _ := zap.NewDevelopment()
stat.Init(
stat.WithLog(l),
stat.WithPrintInterval(time.Minute),
stat.WithEnableAlarm(stat.WithCPUThreshold(0.9), stat.WithMemoryThreshold(0.85)), // invalid if it is windows
stat.WithPrintField(logger.String("service_name", cfg.App.Name), logger.String("host", cfg.App.Host)), // add custom fields to log
)
# Functions
Init initialize statistical information.
WithAlarm enable alarm and notify, except windows.
WithCPUThreshold set cpu threshold, range 0 to 1.
WithLog set zapLog.
WithMemoryThreshold set memory threshold, range 0 to 1.
WithPrintField set print field.
WithPrintInterval set print interval.