{"modulePath":"github.com/linuxsuren/api-testing","version":"v0.0.21","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package logging\n\n## Types\n\n```go\ntype APITestingLogComponent string\n```\nAPITestingLogComponent defines a make up part that supports a configured logging level.\n\n```go\nconst (\n\t// LogComponentAPITestingDefault defines the \"default\"-wide logging component. When specified,\n\t// all other logging components are ignored.\n\tLogComponentAPITestingDefault APITestingLogComponent = \"default\"\n\n\t// LogComponentAPITestingTesting represents the logging component for testing.\n\tLogComponentAPITestingTesting APITestingLogComponent = \"testing\"\n)\n```\n\n```go\ntype APITestingLogging struct {\n\t// Level is the logging level. If unspecified, defaults to \"info\".\n\tLevel map[APITestingLogComponent]LogLevel\n}\n```\nAPITestingLogging defines logging for api-testing.\n\n```go\nfunc DefaultAPITestingLogging() *APITestingLogging\n```\nDefaultAPITestingLogging returns a new APITestingLogging with default configuration parameters.\n\n```go\nfunc (logging *APITestingLogging) DefaultAPITestingLoggingLevel(level LogLevel) LogLevel\n```\nDefaultAPITestingLoggingLevel returns a new APITestingLogging with default configuration parameters. When LogComponentAPITestingDefault specified, all other logging components are ignored.\n\n```go\ntype LogLevel string\n```\nLogLevel defines a log level for api-testing logs.\n\n```go\nconst (\n\t// LogLevelDebug defines the \"debug\" logging level.\n\tLogLevelDebug LogLevel = \"debug\"\n\n\t// LogLevelInfo defines the \"Info\" logging level.\n\tLogLevelInfo LogLevel = \"info\"\n\n\t// LogLevelWarn defines the \"Warn\" logging level.\n\tLogLevelWarn LogLevel = \"warn\"\n\n\t// LogLevelError defines the \"Error\" logging level.\n\tLogLevelError LogLevel = \"error\"\n)\n```\nLog level const.\n\n```go\ntype Logger struct {\n\t// Embedded Logger interface\n\tlogr.Logger\n\t// contains filtered or unexported fields\n}\n```\nLogger represents a logger.\n\n```go\nfunc DefaultLogger(level LogLevel) Logger\n```\n\n```go\nfunc FileLogger(file string, name string, level LogLevel) Logger\n```\nFileLogger returns a file logger. file is the path of the log file. name is the name of the logger. level is the log level of the logger. The returned logger can write logs to the specified file.\n\n```go\nfunc NewLogger(logging *APITestingLogging) Logger\n```\n\n```go\nfunc (l Logger) Sugar() *zap.SugaredLogger\n```\nA Sugar wraps the base Logger functionality in a slower, but less verbose, API. Any Logger can be converted to a SugaredLogger with its Sugar method.\n\nUnlike the Logger, the SugaredLogger doesn't insist on structured logging. For each log level, it exposes four methods:\n\n  - methods named after the log level for log.Print-style logging\n  - methods ending in \"w\" for loosely-typed structured logging\n  - methods ending in \"f\" for log.Printf-style logging\n  - methods ending in \"ln\" for log.Println-style logging\n\nUsed:\n\n\tInfo(...any)           Print-style logging\n\tInfow(...any)          Structured logging (read as \"info with\")\n\tInfof(string, ...any)  Printf-style logging\n\tInfoln(...any)         Println-style logging\n\n```go\nfunc (l Logger) WithName(name string) Logger\n```\nWithName returns a new Logger instance with the specified name element added to the Logger's name.  Successive calls with WithName append additional suffixes to the Logger's name.  It's strongly recommended that name segments contain only letters, digits, and hyphens (see the package documentation for more information).\n\n```go\nfunc (l Logger) WithNameAndWriter(name string, writer io.Writer) Logger\n```\n\n```go\nfunc (l Logger) WithValues(keysAndValues ...interface{}) Logger\n```\nWithValues returns a new Logger instance with additional key/value pairs. See Info for documentation on how key/value pairs work.\n\n","path":"github.com/linuxsuren/api-testing/pkg/logging","name":"logging","synopsis":"","isRedistributable":true}
