Documentation ¶
Overview ¶
Package config defines types for application configuration.
There is no init() call to set up configuration a priori. The reason is to avoid coupling to a specific configuration framework, but rather relay this decision to the client.
Please refer to package schuko.gconf for concrete usage.
BSD License ¶
Copyright (c) 2017–21, Norbert Pillmayer ¶
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of this software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTraceAdapter ¶
AddTraceAdapter is an extension point for clients who want to use their own tracing adapter implementation. key will be used at configuration initialization time to identify this adapter, e.g. in configuration files.
Clients will have to call this before any call to tracing-initialization, otherwise the adapter cannot be found.
func GetAdapterFromConfiguration ¶
func GetAdapterFromConfiguration(conf Configuration) tracing.Adapter
GetAdapterFromConfiguration gets the concrete tracing implementation adapter from the appcation configuration. The configuration key name is "tracing".
The value must be one of the known tracing adapter keys. Default is an adapter for the Go standard log package.
Types ¶
type Configuration ¶
type Configuration interface { InitDefaults() // initialize key/value pairs IsSet(key string) bool // is a config key set? GetString(key string) string // get config value as string GetInt(key string) int // get config value as integer GetBool(key string) bool // get config value as boolean IsInteractive() bool // Are we running in interactive mode? }
Configuration is an interface to be implemented by every configuration adapter.
Directories ¶
Path | Synopsis |
---|---|
Package appconfig provides configuration and tracing suitable for full fledged applications.
|
Package appconfig provides configuration and tracing suitable for full fledged applications. |
Package gconf initializes a global application configuration.
|
Package gconf initializes a global application configuration. |
Package gtrace lets clients set up a set of global tracers.
|
Package gtrace lets clients set up a set of global tracers. |
Package testadapter is for application configuration during tests.
|
Package testadapter is for application configuration during tests. |
Package testconfig provides configuration and tracing suitable for tests.
|
Package testconfig provides configuration and tracing suitable for tests. |
Package tracing defines an interface used by all other packages.
|
Package tracing defines an interface used by all other packages. |
gologadapter
Package gologadapter implements tracing with the default Go logger.
|
Package gologadapter implements tracing with the default Go logger. |
gotestingadapter
Package gotestingadapter implements tracing with the Go testing logger.
|
Package gotestingadapter implements tracing with the Go testing logger. |
logrusadapter
Package logrusadapter implements tracing with the logrus logger.
|
Package logrusadapter implements tracing with the logrus logger. |
Package viperadapter is for application configuration.
|
Package viperadapter is for application configuration. |