{"modulePath":"github.com/GoPlugin/pluginV2Lib/libocr","version":"v0.0.0-20230622090102-3f0f60f3c385","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package loghelper\n\n## Functions\n\n```go\nfunc CloseLogError(closer io.Closer, logger commontypes.Logger, msg string)\n```\nCloses closer. If an error occurs, it is logged at WARN level together with msg\n\n```go\nfunc MergeOverwrite(upserts ...commontypes.LogFields) commontypes.LogFields\n```\nMergeOverwrite will create a new LogFields and add all the properties from upserts on it. Key conflicts are resolved by preferring the upserted value.\n\n```go\nfunc MergePreserve(extras ...commontypes.LogFields) commontypes.LogFields\n```\nMergePreserve will create a new LogFields and add all the properties from extras on it. Key conflicts are resolved by prefixing the key for the new value with underscores until there's no conflict.\n\n## Types\n\n```go\ntype IfNotStopped struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewIfNotStopped(d time.Duration, f func()) *IfNotStopped\n```\nIf Stop is called prior to expiry of d, f won't be executed. Otherwise, f will be executed and Stop will block until f returns. That makes it different from the standard library's time.AfterFunc() whose Stop() function will return while f is still running.\n\n```go\nfunc (ins *IfNotStopped) Stop()\n```\n\n```go\ntype LogarithmicTaper struct {\n\t// contains filtered or unexported fields\n}\n```\nLogarithmicTaper provides logarithmic tapering of an event sequence. For example, if the taper is Triggered 50 times with a function that simply prints the provided count, the output would be 1,2,4,8,16,32.\n\n```go\nfunc (tap *LogarithmicTaper) Count() uint64\n```\nCount returns the internal count of the taper\n\n```go\nfunc (tap *LogarithmicTaper) Reset(f func(oldCount uint64))\n```\nReset resets the count to 0 and then calls f with the previous count iff it wasn't already 0\n\n```go\nfunc (tap *LogarithmicTaper) Trigger(f func(newCount uint64))\n```\nTrigger increments a count and calls f iff the new count is a power of two\n\n```go\ntype LoggerWithContext interface {\n\tcommontypes.Logger\n\tMakeChild(extraContext commontypes.LogFields) LoggerWithContext\n\tMakeUpdated(updatedContext commontypes.LogFields) LoggerWithContext\n\tErrorIfNotCanceled(msg string, ctx context.Context, fields commontypes.LogFields)\n}\n```\n\n```go\nfunc MakeRootLoggerWithContext(logger commontypes.Logger) LoggerWithContext\n```\nMakeRootLoggerWithContext creates a base logger by wrapping a commontypes.Logger. NOTE! Most loggers should extend an existing LoggerWithContext using MakeChild!\n\n","path":"github.com/GoPlugin/pluginV2Lib/libocr/internal/loghelper","name":"loghelper","synopsis":"","isRedistributable":true}
