// NewLoggerFromConfigString reads the string and build a logger. It can be used // to build a new logger and assign it to binarylog.Logger. // // Example filter config strings: // - "" Nothing will be logged // - "*" All headers and messages will be fully logged. // - "*{h}" Only headers will be logged. // - "*{m:256}" Only the first 256 bytes of each message will be logged. // - "Foo/*" Logs every method in service Foo // - "Foo/*,-Foo/Bar" Logs every method in service Foo except method /Foo/Bar // - "Foo/*,Foo/Bar{m:256}" Logs the first 256 bytes of each message in method // /Foo/Bar, logs all headers and messages in every other method in service // Foo. // // If two configs exist for one certain method or service, the one specified // later overrides the previous config. func NewLoggerFromConfigString(s string) Logger { … } // fillMethodLoggerWithConfigString parses config, creates TruncatingMethodLogger and adds // it to the right map in the logger. func (l *logger) fillMethodLoggerWithConfigString(config string) error { … } const maxUInt … const longMethodConfigRegexpStr … const optionalLengthRegexpStr … const headerConfigRegexpStr … const messageConfigRegexpStr … const headerMessageConfigRegexpStr … var longMethodConfigRegexp … var headerConfigRegexp … var messageConfigRegexp … var headerMessageConfigRegexp … // Turn "service/method{h;m}" into "service", "method", "{h;m}". func parseMethodConfigAndSuffix(c string) (service, method, suffix string, _ error) { … } // Turn "{h:123;m:345}" into 123, 345. // // Return maxUInt if length is unspecified. func parseHeaderMessageLengthConfig(c string) (hdrLenStr, msgLenStr uint64, err error) { … }