cord-776 create build / runtime containers for autmation uservices
Change-Id: I246973192adef56a250ffe93a5f65fff488840c1
diff --git a/switchq/vendor/github.com/juju/loggo/LICENSE b/switchq/vendor/github.com/juju/loggo/LICENSE
new file mode 100644
index 0000000..ade9307
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/LICENSE
@@ -0,0 +1,191 @@
+All files in this repository are licensed as follows. If you contribute
+to this repository, it is assumed that you license your contribution
+under the same license unless you state otherwise.
+
+All files Copyright (C) 2015 Canonical Ltd. unless otherwise specified in the file.
+
+This software is licensed under the LGPLv3, included below.
+
+As a special exception to the GNU Lesser General Public License version 3
+("LGPL3"), the copyright holders of this Library give you permission to
+convey to a third party a Combined Work that links statically or dynamically
+to this Library without providing any Minimal Corresponding Source or
+Minimal Application Code as set out in 4d or providing the installation
+information set out in section 4e, provided that you comply with the other
+provisions of LGPL3 and provided that you meet, for the Application the
+terms and conditions of the license(s) which apply to the Application.
+
+Except as stated in this special exception, the provisions of LGPL3 will
+continue to comply in full to this Library. If you modify this Library, you
+may apply this exception to your version of this Library, but you are not
+obliged to do so. If you do not wish to do so, delete this exception
+statement from your version. This exception does not (and cannot) modify any
+license terms which apply to the Application, with which you must still
+comply.
+
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/switchq/vendor/github.com/juju/loggo/Makefile b/switchq/vendor/github.com/juju/loggo/Makefile
new file mode 100644
index 0000000..89afa49
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/Makefile
@@ -0,0 +1,11 @@
+default: check
+
+check:
+ go test
+
+docs:
+ godoc2md github.com/juju/loggo > README.md
+ sed -i 's|\[godoc-link-here\]|[![GoDoc](https://godoc.org/github.com/juju/loggo?status.svg)](https://godoc.org/github.com/juju/loggo)|' README.md
+
+
+.PHONY: default check docs
diff --git a/switchq/vendor/github.com/juju/loggo/README.md b/switchq/vendor/github.com/juju/loggo/README.md
new file mode 100644
index 0000000..a73a9db
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/README.md
@@ -0,0 +1,711 @@
+
+# loggo
+ import "github.com/juju/loggo"
+
+[![GoDoc](https://godoc.org/github.com/juju/loggo?status.svg)](https://godoc.org/github.com/juju/loggo)
+
+### Module level logging for Go
+This package provides an alternative to the standard library log package.
+
+The actual logging functions never return errors. If you are logging
+something, you really don't want to be worried about the logging
+having trouble.
+
+Modules have names that are defined by dotted strings.
+
+
+ "first.second.third"
+
+There is a root module that has the name `""`. Each module
+(except the root module) has a parent, identified by the part of
+the name without the last dotted value.
+* the parent of "first.second.third" is "first.second"
+* the parent of "first.second" is "first"
+* the parent of "first" is "" (the root module)
+
+Each module can specify its own severity level. Logging calls that are of
+a lower severity than the module's effective severity level are not written
+out.
+
+Loggers are created using the GetLogger function.
+
+
+ logger := loggo.GetLogger("foo.bar")
+
+By default there is one writer registered, which will write to Stderr,
+and the root module, which will only emit warnings and above.
+If you want to continue using the default
+logger, but have it emit all logging levels you need to do the following.
+
+
+ writer, _, err := loggo.RemoveWriter("default")
+ // err is non-nil if and only if the name isn't found.
+ loggo.RegisterWriter("default", writer, loggo.TRACE)
+
+
+
+
+## Constants
+``` go
+const DefaultWriterName = "default"
+```
+DefaultWriterName is the name of the default writer for
+a Context.
+
+
+## Variables
+``` go
+var (
+ // SeverityColor defines the colors for the levels output by the ColorWriter.
+ SeverityColor = map[Level]*ansiterm.Context{
+ TRACE: ansiterm.Foreground(ansiterm.Default),
+ DEBUG: ansiterm.Foreground(ansiterm.Green),
+ INFO: ansiterm.Foreground(ansiterm.BrightBlue),
+ WARNING: ansiterm.Foreground(ansiterm.Yellow),
+ ERROR: ansiterm.Foreground(ansiterm.BrightRed),
+ CRITICAL: &ansiterm.Context{
+ Foreground: ansiterm.White,
+ Background: ansiterm.Red,
+ },
+ }
+ // LocationColor defines the colors for the location output by the ColorWriter.
+ LocationColor = ansiterm.Foreground(ansiterm.BrightBlue)
+)
+```
+``` go
+var TimeFormat = initTimeFormat()
+```
+TimeFormat is the time format used for the default writer.
+This can be set with the environment variable LOGGO_TIME_FORMAT.
+
+
+## func ConfigureLoggers
+``` go
+func ConfigureLoggers(specification string) error
+```
+ConfigureLoggers configures loggers according to the given string
+specification, which specifies a set of modules and their associated
+logging levels. Loggers are colon- or semicolon-separated; each
+module is specified as <modulename>=<level>. White space outside of
+module names and levels is ignored. The root module is specified
+with the name "<root>".
+
+An example specification:
+
+
+ `<root>=ERROR; foo.bar=WARNING`
+
+
+## func DefaultFormatter
+``` go
+func DefaultFormatter(entry Entry) string
+```
+DefaultFormatter returns the parameters separated by spaces except for
+filename and line which are separated by a colon. The timestamp is shown
+to second resolution in UTC. For example:
+
+
+ 2016-07-02 15:04:05
+
+
+## func LoggerInfo
+``` go
+func LoggerInfo() string
+```
+LoggerInfo returns information about the configured loggers and their
+logging levels. The information is returned in the format expected by
+ConfigureLoggers. Loggers with UNSPECIFIED level will not
+be included.
+
+
+## func RegisterWriter
+``` go
+func RegisterWriter(name string, writer Writer) error
+```
+RegisterWriter adds the writer to the list of writers in the DefaultContext
+that get notified when logging. If there is already a registered writer
+with that name, an error is returned.
+
+
+## func ResetLogging
+``` go
+func ResetLogging()
+```
+ResetLogging iterates through the known modules and sets the levels of all
+to UNSPECIFIED, except for <root> which is set to WARNING. The call also
+removes all writers in the DefaultContext and puts the original default
+writer back as the only writer.
+
+
+## func ResetWriters
+``` go
+func ResetWriters()
+```
+ResetWriters puts the list of writers back into the initial state.
+
+
+
+## type Config
+``` go
+type Config map[string]Level
+```
+Config is a mapping of logger module names to logging severity levels.
+
+
+
+
+
+
+
+
+
+### func ParseConfigString
+``` go
+func ParseConfigString(specification string) (Config, error)
+```
+ParseConfigString parses a logger configuration string into a map of logger
+names and their associated log level. This method is provided to allow
+other programs to pre-validate a configuration string rather than just
+calling ConfigureLoggers.
+
+Logging modules are colon- or semicolon-separated; each module is specified
+as <modulename>=<level>. White space outside of module names and levels is
+ignored. The root module is specified with the name "<root>".
+
+As a special case, a log level may be specified on its own.
+This is equivalent to specifying the level of the root module,
+so "DEBUG" is equivalent to `<root>=DEBUG`
+
+An example specification:
+
+
+ `<root>=ERROR; foo.bar=WARNING`
+
+
+
+
+### func (Config) String
+``` go
+func (c Config) String() string
+```
+String returns a logger configuration string that may be parsed
+using ParseConfigurationString.
+
+
+
+## type Context
+``` go
+type Context struct {
+ // contains filtered or unexported fields
+}
+```
+Context produces loggers for a hierarchy of modules. The context holds
+a collection of hierarchical loggers and their writers.
+
+
+
+
+
+
+
+
+
+### func DefaultContext
+``` go
+func DefaultContext() *Context
+```
+DefaultContext returns the global default logging context.
+
+
+### func NewContext
+``` go
+func NewContext(rootLevel Level) *Context
+```
+NewLoggers returns a new Context with no writers set.
+If the root level is UNSPECIFIED, WARNING is used.
+
+
+
+
+### func (\*Context) AddWriter
+``` go
+func (c *Context) AddWriter(name string, writer Writer) error
+```
+AddWriter adds a writer to the list to be called for each logging call.
+The name cannot be empty, and the writer cannot be nil. If an existing
+writer exists with the specified name, an error is returned.
+
+
+
+### func (\*Context) ApplyConfig
+``` go
+func (c *Context) ApplyConfig(config Config)
+```
+ApplyConfig configures the logging modules according to the provided config.
+
+
+
+### func (\*Context) CompleteConfig
+``` go
+func (c *Context) CompleteConfig() Config
+```
+CompleteConfig returns all the loggers and their defined levels,
+even if that level is UNSPECIFIED.
+
+
+
+### func (\*Context) Config
+``` go
+func (c *Context) Config() Config
+```
+Config returns the current configuration of the Loggers. Loggers
+with UNSPECIFIED level will not be included.
+
+
+
+### func (\*Context) GetLogger
+``` go
+func (c *Context) GetLogger(name string) Logger
+```
+GetLogger returns a Logger for the given module name, creating it and
+its parents if necessary.
+
+
+
+### func (\*Context) RemoveWriter
+``` go
+func (c *Context) RemoveWriter(name string) (Writer, error)
+```
+RemoveWriter remotes the specified writer. If a writer is not found with
+the specified name an error is returned. The writer that was removed is also
+returned.
+
+
+
+### func (\*Context) ReplaceWriter
+``` go
+func (c *Context) ReplaceWriter(name string, writer Writer) (Writer, error)
+```
+ReplaceWriter is a convenience method that does the equivalent of RemoveWriter
+followed by AddWriter with the same name. The replaced writer is returned.
+
+
+
+### func (\*Context) ResetLoggerLevels
+``` go
+func (c *Context) ResetLoggerLevels()
+```
+ResetLoggerLevels iterates through the known logging modules and sets the
+levels of all to UNSPECIFIED, except for <root> which is set to WARNING.
+
+
+
+### func (\*Context) ResetWriters
+``` go
+func (c *Context) ResetWriters()
+```
+ResetWriters is generally only used in testing and removes all the writers.
+
+
+
+## type Entry
+``` go
+type Entry struct {
+ // Level is the severity of the log message.
+ Level Level
+ // Module is the dotted module name from the logger.
+ Module string
+ // Filename is the full path the file that logged the message.
+ Filename string
+ // Line is the line number of the Filename.
+ Line int
+ // Timestamp is when the log message was created
+ Timestamp time.Time
+ // Message is the formatted string from teh log call.
+ Message string
+}
+```
+Entry represents a single log message.
+
+
+
+
+
+
+
+
+
+
+
+## type Level
+``` go
+type Level uint32
+```
+Level holds a severity level.
+
+
+
+``` go
+const (
+ UNSPECIFIED Level = iota
+ TRACE
+ DEBUG
+ INFO
+ WARNING
+ ERROR
+ CRITICAL
+)
+```
+The severity levels. Higher values are more considered more
+important.
+
+
+
+
+
+
+
+### func ParseLevel
+``` go
+func ParseLevel(level string) (Level, bool)
+```
+ParseLevel converts a string representation of a logging level to a
+Level. It returns the level and whether it was valid or not.
+
+
+
+
+### func (Level) Short
+``` go
+func (level Level) Short() string
+```
+Short returns a five character string to use in
+aligned logging output.
+
+
+
+### func (Level) String
+``` go
+func (level Level) String() string
+```
+String implements Stringer.
+
+
+
+## type Logger
+``` go
+type Logger struct {
+ // contains filtered or unexported fields
+}
+```
+A Logger represents a logging module. It has an associated logging
+level which can be changed; messages of lesser severity will
+be dropped. Loggers have a hierarchical relationship - see
+the package documentation.
+
+The zero Logger value is usable - any messages logged
+to it will be sent to the root Logger.
+
+
+
+
+
+
+
+
+
+### func GetLogger
+``` go
+func GetLogger(name string) Logger
+```
+GetLogger returns a Logger for the given module name,
+creating it and its parents if necessary.
+
+
+
+
+### func (Logger) Criticalf
+``` go
+func (logger Logger) Criticalf(message string, args ...interface{})
+```
+Criticalf logs the printf-formatted message at critical level.
+
+
+
+### func (Logger) Debugf
+``` go
+func (logger Logger) Debugf(message string, args ...interface{})
+```
+Debugf logs the printf-formatted message at debug level.
+
+
+
+### func (Logger) EffectiveLogLevel
+``` go
+func (logger Logger) EffectiveLogLevel() Level
+```
+EffectiveLogLevel returns the effective min log level of
+the receiver - that is, messages with a lesser severity
+level will be discarded.
+
+If the log level of the receiver is unspecified,
+it will be taken from the effective log level of its
+parent.
+
+
+
+### func (Logger) Errorf
+``` go
+func (logger Logger) Errorf(message string, args ...interface{})
+```
+Errorf logs the printf-formatted message at error level.
+
+
+
+### func (Logger) Infof
+``` go
+func (logger Logger) Infof(message string, args ...interface{})
+```
+Infof logs the printf-formatted message at info level.
+
+
+
+### func (Logger) IsDebugEnabled
+``` go
+func (logger Logger) IsDebugEnabled() bool
+```
+IsDebugEnabled returns whether debugging is enabled
+at debug level.
+
+
+
+### func (Logger) IsErrorEnabled
+``` go
+func (logger Logger) IsErrorEnabled() bool
+```
+IsErrorEnabled returns whether debugging is enabled
+at error level.
+
+
+
+### func (Logger) IsInfoEnabled
+``` go
+func (logger Logger) IsInfoEnabled() bool
+```
+IsInfoEnabled returns whether debugging is enabled
+at info level.
+
+
+
+### func (Logger) IsLevelEnabled
+``` go
+func (logger Logger) IsLevelEnabled(level Level) bool
+```
+IsLevelEnabled returns whether debugging is enabled
+for the given log level.
+
+
+
+### func (Logger) IsTraceEnabled
+``` go
+func (logger Logger) IsTraceEnabled() bool
+```
+IsTraceEnabled returns whether debugging is enabled
+at trace level.
+
+
+
+### func (Logger) IsWarningEnabled
+``` go
+func (logger Logger) IsWarningEnabled() bool
+```
+IsWarningEnabled returns whether debugging is enabled
+at warning level.
+
+
+
+### func (Logger) LogCallf
+``` go
+func (logger Logger) LogCallf(calldepth int, level Level, message string, args ...interface{})
+```
+LogCallf logs a printf-formatted message at the given level.
+The location of the call is indicated by the calldepth argument.
+A calldepth of 1 means the function that called this function.
+A message will be discarded if level is less than the
+the effective log level of the logger.
+Note that the writers may also filter out messages that
+are less than their registered minimum severity level.
+
+
+
+### func (Logger) LogLevel
+``` go
+func (logger Logger) LogLevel() Level
+```
+LogLevel returns the configured min log level of the logger.
+
+
+
+### func (Logger) Logf
+``` go
+func (logger Logger) Logf(level Level, message string, args ...interface{})
+```
+Logf logs a printf-formatted message at the given level.
+A message will be discarded if level is less than the
+the effective log level of the logger.
+Note that the writers may also filter out messages that
+are less than their registered minimum severity level.
+
+
+
+### func (Logger) Name
+``` go
+func (logger Logger) Name() string
+```
+Name returns the logger's module name.
+
+
+
+### func (Logger) SetLogLevel
+``` go
+func (logger Logger) SetLogLevel(level Level)
+```
+SetLogLevel sets the severity level of the given logger.
+The root logger cannot be set to UNSPECIFIED level.
+See EffectiveLogLevel for how this affects the
+actual messages logged.
+
+
+
+### func (Logger) Tracef
+``` go
+func (logger Logger) Tracef(message string, args ...interface{})
+```
+Tracef logs the printf-formatted message at trace level.
+
+
+
+### func (Logger) Warningf
+``` go
+func (logger Logger) Warningf(message string, args ...interface{})
+```
+Warningf logs the printf-formatted message at warning level.
+
+
+
+## type TestWriter
+``` go
+type TestWriter struct {
+ // contains filtered or unexported fields
+}
+```
+TestWriter is a useful Writer for testing purposes. Each component of the
+logging message is stored in the Log array.
+
+
+
+
+
+
+
+
+
+
+
+### func (\*TestWriter) Clear
+``` go
+func (writer *TestWriter) Clear()
+```
+Clear removes any saved log messages.
+
+
+
+### func (\*TestWriter) Log
+``` go
+func (writer *TestWriter) Log() []Entry
+```
+Log returns a copy of the current logged values.
+
+
+
+### func (\*TestWriter) Write
+``` go
+func (writer *TestWriter) Write(entry Entry)
+```
+Write saves the params as members in the TestLogValues struct appended to the Log array.
+
+
+
+## type Writer
+``` go
+type Writer interface {
+ // Write writes a message to the Writer with the given level and module
+ // name. The filename and line hold the file name and line number of the
+ // code that is generating the log message; the time stamp holds the time
+ // the log message was generated, and message holds the log message
+ // itself.
+ Write(entry Entry)
+}
+```
+Writer is implemented by any recipient of log messages.
+
+
+
+
+
+
+
+
+
+### func NewColorWriter
+``` go
+func NewColorWriter(writer io.Writer) Writer
+```
+NewColorWriter will write out colored severity levels if the writer is
+outputting to a terminal.
+
+
+### func NewMinimumLevelWriter
+``` go
+func NewMinimumLevelWriter(writer Writer, minLevel Level) Writer
+```
+NewMinLevelWriter returns a Writer that will only pass on the Write calls
+to the provided writer if the log level is at or above the specified
+minimum level.
+
+
+### func NewSimpleWriter
+``` go
+func NewSimpleWriter(writer io.Writer, formatter func(entry Entry) string) Writer
+```
+NewSimpleWriter returns a new writer that writes log messages to the given
+io.Writer formatting the messages with the given formatter.
+
+
+### func RemoveWriter
+``` go
+func RemoveWriter(name string) (Writer, error)
+```
+RemoveWriter removes the Writer identified by 'name' and returns it.
+If the Writer is not found, an error is returned.
+
+
+### func ReplaceDefaultWriter
+``` go
+func ReplaceDefaultWriter(writer Writer) (Writer, error)
+```
+ReplaceDefaultWriter is a convenience method that does the equivalent of
+RemoveWriter and then RegisterWriter with the name "default". The previous
+default writer, if any is returned.
+
+
+
+
+
+
+
+
+
+
+- - -
+Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)
\ No newline at end of file
diff --git a/switchq/vendor/github.com/juju/loggo/config.go b/switchq/vendor/github.com/juju/loggo/config.go
new file mode 100644
index 0000000..1b3eaa5
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/config.go
@@ -0,0 +1,96 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import (
+ "fmt"
+ "sort"
+ "strings"
+)
+
+// Config is a mapping of logger module names to logging severity levels.
+type Config map[string]Level
+
+// String returns a logger configuration string that may be parsed
+// using ParseConfigurationString.
+func (c Config) String() string {
+ if c == nil {
+ return ""
+ }
+ // output in alphabetical order.
+ names := []string{}
+ for name := range c {
+ names = append(names, name)
+ }
+ sort.Strings(names)
+
+ var entries []string
+ for _, name := range names {
+ level := c[name]
+ if name == "" {
+ name = rootString
+ }
+ entry := fmt.Sprintf("%s=%s", name, level)
+ entries = append(entries, entry)
+ }
+ return strings.Join(entries, ";")
+}
+
+func parseConfigValue(value string) (string, Level, error) {
+ pair := strings.SplitN(value, "=", 2)
+ if len(pair) < 2 {
+ return "", UNSPECIFIED, fmt.Errorf("config value expected '=', found %q", value)
+ }
+ name := strings.TrimSpace(pair[0])
+ if name == "" {
+ return "", UNSPECIFIED, fmt.Errorf("config value %q has missing module name", value)
+ }
+
+ levelStr := strings.TrimSpace(pair[1])
+ level, ok := ParseLevel(levelStr)
+ if !ok {
+ return "", UNSPECIFIED, fmt.Errorf("unknown severity level %q", levelStr)
+ }
+ if name == rootString {
+ name = ""
+ }
+ return name, level, nil
+}
+
+// ParseConfigString parses a logger configuration string into a map of logger
+// names and their associated log level. This method is provided to allow
+// other programs to pre-validate a configuration string rather than just
+// calling ConfigureLoggers.
+//
+// Logging modules are colon- or semicolon-separated; each module is specified
+// as <modulename>=<level>. White space outside of module names and levels is
+// ignored. The root module is specified with the name "<root>".
+//
+// As a special case, a log level may be specified on its own.
+// This is equivalent to specifying the level of the root module,
+// so "DEBUG" is equivalent to `<root>=DEBUG`
+//
+// An example specification:
+// `<root>=ERROR; foo.bar=WARNING`
+func ParseConfigString(specification string) (Config, error) {
+ specification = strings.TrimSpace(specification)
+ if specification == "" {
+ return nil, nil
+ }
+ cfg := make(Config)
+ if level, ok := ParseLevel(specification); ok {
+ cfg[""] = level
+ return cfg, nil
+ }
+
+ values := strings.FieldsFunc(specification, func(r rune) bool { return r == ';' || r == ':' })
+ for _, value := range values {
+ name, level, err := parseConfigValue(value)
+ if err != nil {
+ return nil, err
+ }
+ cfg[name] = level
+ }
+ return cfg, nil
+}
diff --git a/switchq/vendor/github.com/juju/loggo/context.go b/switchq/vendor/github.com/juju/loggo/context.go
new file mode 100644
index 0000000..f5739d9
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/context.go
@@ -0,0 +1,198 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import (
+ "fmt"
+ "strings"
+ "sync"
+)
+
+// Context produces loggers for a hierarchy of modules. The context holds
+// a collection of hierarchical loggers and their writers.
+type Context struct {
+ root *module
+
+ // Perhaps have one mutex?
+ modulesMutex sync.Mutex
+ modules map[string]*module
+
+ writersMutex sync.Mutex
+ writers map[string]Writer
+
+ // writeMuxtex is used to serialise write operations.
+ writeMutex sync.Mutex
+}
+
+// NewLoggers returns a new Context with no writers set.
+// If the root level is UNSPECIFIED, WARNING is used.
+func NewContext(rootLevel Level) *Context {
+ if rootLevel < TRACE || rootLevel > CRITICAL {
+ rootLevel = WARNING
+ }
+ context := &Context{
+ modules: make(map[string]*module),
+ writers: make(map[string]Writer),
+ }
+ context.root = &module{
+ level: rootLevel,
+ context: context,
+ }
+ context.modules[""] = context.root
+ return context
+}
+
+// GetLogger returns a Logger for the given module name, creating it and
+// its parents if necessary.
+func (c *Context) GetLogger(name string) Logger {
+ name = strings.TrimSpace(strings.ToLower(name))
+ c.modulesMutex.Lock()
+ defer c.modulesMutex.Unlock()
+ return Logger{c.getLoggerModule(name)}
+}
+
+func (c *Context) getLoggerModule(name string) *module {
+ if name == rootString {
+ name = ""
+ }
+ impl, found := c.modules[name]
+ if found {
+ return impl
+ }
+ parentName := ""
+ if i := strings.LastIndex(name, "."); i >= 0 {
+ parentName = name[0:i]
+ }
+ parent := c.getLoggerModule(parentName)
+ impl = &module{name, UNSPECIFIED, parent, c}
+ c.modules[name] = impl
+ return impl
+}
+
+// Config returns the current configuration of the Loggers. Loggers
+// with UNSPECIFIED level will not be included.
+func (c *Context) Config() Config {
+ result := make(Config)
+ c.modulesMutex.Lock()
+ defer c.modulesMutex.Unlock()
+
+ for name, module := range c.modules {
+ if module.level != UNSPECIFIED {
+ result[name] = module.level
+ }
+ }
+ return result
+}
+
+// CompleteConfig returns all the loggers and their defined levels,
+// even if that level is UNSPECIFIED.
+func (c *Context) CompleteConfig() Config {
+ result := make(Config)
+ c.modulesMutex.Lock()
+ defer c.modulesMutex.Unlock()
+
+ for name, module := range c.modules {
+ result[name] = module.level
+ }
+ return result
+}
+
+// ApplyConfig configures the logging modules according to the provided config.
+func (c *Context) ApplyConfig(config Config) {
+ c.modulesMutex.Lock()
+ defer c.modulesMutex.Unlock()
+ for name, level := range config {
+ module := c.getLoggerModule(name)
+ module.setLevel(level)
+ }
+}
+
+// ResetLoggerLevels iterates through the known logging modules and sets the
+// levels of all to UNSPECIFIED, except for <root> which is set to WARNING.
+func (c *Context) ResetLoggerLevels() {
+ c.modulesMutex.Lock()
+ defer c.modulesMutex.Unlock()
+ // Setting the root module to UNSPECIFIED will set it to WARNING.
+ for _, module := range c.modules {
+ module.setLevel(UNSPECIFIED)
+ }
+}
+
+func (c *Context) write(entry Entry) {
+ c.writeMutex.Lock()
+ defer c.writeMutex.Unlock()
+ for _, writer := range c.getWriters() {
+ writer.Write(entry)
+ }
+}
+
+func (c *Context) getWriters() []Writer {
+ c.writersMutex.Lock()
+ defer c.writersMutex.Unlock()
+ var result []Writer
+ for _, writer := range c.writers {
+ result = append(result, writer)
+ }
+ return result
+}
+
+// AddWriter adds a writer to the list to be called for each logging call.
+// The name cannot be empty, and the writer cannot be nil. If an existing
+// writer exists with the specified name, an error is returned.
+func (c *Context) AddWriter(name string, writer Writer) error {
+ if name == "" {
+ return fmt.Errorf("name cannot be empty")
+ }
+ if writer == nil {
+ return fmt.Errorf("writer cannot be nil")
+ }
+ c.writersMutex.Lock()
+ defer c.writersMutex.Unlock()
+ if _, found := c.writers[name]; found {
+ return fmt.Errorf("context already has a writer named %q", name)
+ }
+ c.writers[name] = writer
+ return nil
+}
+
+// RemoveWriter remotes the specified writer. If a writer is not found with
+// the specified name an error is returned. The writer that was removed is also
+// returned.
+func (c *Context) RemoveWriter(name string) (Writer, error) {
+ c.writersMutex.Lock()
+ defer c.writersMutex.Unlock()
+ reg, found := c.writers[name]
+ if !found {
+ return nil, fmt.Errorf("context has no writer named %q", name)
+ }
+ delete(c.writers, name)
+ return reg, nil
+}
+
+// ReplaceWriter is a convenience method that does the equivalent of RemoveWriter
+// followed by AddWriter with the same name. The replaced writer is returned.
+func (c *Context) ReplaceWriter(name string, writer Writer) (Writer, error) {
+ if name == "" {
+ return nil, fmt.Errorf("name cannot be empty")
+ }
+ if writer == nil {
+ return nil, fmt.Errorf("writer cannot be nil")
+ }
+ c.writersMutex.Lock()
+ defer c.writersMutex.Unlock()
+ reg, found := c.writers[name]
+ if !found {
+ return nil, fmt.Errorf("context has no writer named %q", name)
+ }
+ oldWriter := reg
+ c.writers[name] = writer
+ return oldWriter, nil
+}
+
+// ResetWriters is generally only used in testing and removes all the writers.
+func (c *Context) ResetWriters() {
+ c.writersMutex.Lock()
+ defer c.writersMutex.Unlock()
+ c.writers = make(map[string]Writer)
+}
diff --git a/switchq/vendor/github.com/juju/loggo/dependencies.tsv b/switchq/vendor/github.com/juju/loggo/dependencies.tsv
new file mode 100644
index 0000000..20daf32
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/dependencies.tsv
@@ -0,0 +1,5 @@
+github.com/juju/ansiterm git c368f42cb4b32a70389cded05c7345d9ccdce889 2016-08-17T02:52:20Z
+github.com/lunixbochs/vtclean git 4fbf7632a2c6d3fbdb9931439bdbbeded02cbe36 2016-01-25T03:51:06Z
+github.com/mattn/go-colorable git ed8eb9e318d7a84ce5915b495b7d35e0cfe7b5a8 2016-07-31T23:54:17Z
+github.com/mattn/go-isatty git 66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8 2016-08-06T12:27:52Z
+gopkg.in/check.v1 git 4f90aeace3a26ad7021961c297b22c42160c7b25 2016-01-05T16:49:36Z
diff --git a/switchq/vendor/github.com/juju/loggo/doc.go b/switchq/vendor/github.com/juju/loggo/doc.go
new file mode 100644
index 0000000..bb19cd5
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/doc.go
@@ -0,0 +1,42 @@
+// Copyright 2014 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+/*
+[godoc-link-here]
+
+Module level logging for Go
+
+This package provides an alternative to the standard library log package.
+
+The actual logging functions never return errors. If you are logging
+something, you really don't want to be worried about the logging
+having trouble.
+
+Modules have names that are defined by dotted strings.
+ "first.second.third"
+
+There is a root module that has the name `""`. Each module
+(except the root module) has a parent, identified by the part of
+the name without the last dotted value.
+* the parent of "first.second.third" is "first.second"
+* the parent of "first.second" is "first"
+* the parent of "first" is "" (the root module)
+
+Each module can specify its own severity level. Logging calls that are of
+a lower severity than the module's effective severity level are not written
+out.
+
+Loggers are created using the GetLogger function.
+ logger := loggo.GetLogger("foo.bar")
+
+By default there is one writer registered, which will write to Stderr,
+and the root module, which will only emit warnings and above.
+If you want to continue using the default
+logger, but have it emit all logging levels you need to do the following.
+
+ writer, _, err := loggo.RemoveWriter("default")
+ // err is non-nil if and only if the name isn't found.
+ loggo.RegisterWriter("default", writer, loggo.TRACE)
+
+*/
+package loggo
diff --git a/switchq/vendor/github.com/juju/loggo/entry.go b/switchq/vendor/github.com/juju/loggo/entry.go
new file mode 100644
index 0000000..b61aa54
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/entry.go
@@ -0,0 +1,22 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import "time"
+
+// Entry represents a single log message.
+type Entry struct {
+ // Level is the severity of the log message.
+ Level Level
+ // Module is the dotted module name from the logger.
+ Module string
+ // Filename is the full path the file that logged the message.
+ Filename string
+ // Line is the line number of the Filename.
+ Line int
+ // Timestamp is when the log message was created
+ Timestamp time.Time
+ // Message is the formatted string from teh log call.
+ Message string
+}
diff --git a/switchq/vendor/github.com/juju/loggo/formatter.go b/switchq/vendor/github.com/juju/loggo/formatter.go
new file mode 100644
index 0000000..ef8aa7a
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/formatter.go
@@ -0,0 +1,38 @@
+// Copyright 2014 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+ "time"
+)
+
+// DefaultFormatter returns the parameters separated by spaces except for
+// filename and line which are separated by a colon. The timestamp is shown
+// to second resolution in UTC. For example:
+// 2016-07-02 15:04:05
+func DefaultFormatter(entry Entry) string {
+ ts := entry.Timestamp.In(time.UTC).Format("2006-01-02 15:04:05")
+ // Just get the basename from the filename
+ filename := filepath.Base(entry.Filename)
+ return fmt.Sprintf("%s %s %s %s:%d %s", ts, entry.Level, entry.Module, filename, entry.Line, entry.Message)
+}
+
+// TimeFormat is the time format used for the default writer.
+// This can be set with the environment variable LOGGO_TIME_FORMAT.
+var TimeFormat = initTimeFormat()
+
+func initTimeFormat() string {
+ format := os.Getenv("LOGGO_TIME_FORMAT")
+ if format != "" {
+ return format
+ }
+ return "15:04:05"
+}
+
+func formatTime(ts time.Time) string {
+ return ts.Format(TimeFormat)
+}
diff --git a/switchq/vendor/github.com/juju/loggo/global.go b/switchq/vendor/github.com/juju/loggo/global.go
new file mode 100644
index 0000000..7cf95ca
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/global.go
@@ -0,0 +1,85 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+var (
+ defaultContext = newDefaultContxt()
+)
+
+func newDefaultContxt() *Context {
+ ctx := NewContext(WARNING)
+ ctx.AddWriter(DefaultWriterName, defaultWriter())
+ return ctx
+}
+
+// DefaultContext returns the global default logging context.
+func DefaultContext() *Context {
+ return defaultContext
+}
+
+// LoggerInfo returns information about the configured loggers and their
+// logging levels. The information is returned in the format expected by
+// ConfigureLoggers. Loggers with UNSPECIFIED level will not
+// be included.
+func LoggerInfo() string {
+ return defaultContext.Config().String()
+}
+
+// GetLogger returns a Logger for the given module name,
+// creating it and its parents if necessary.
+func GetLogger(name string) Logger {
+ return defaultContext.GetLogger(name)
+}
+
+// ResetLogging iterates through the known modules and sets the levels of all
+// to UNSPECIFIED, except for <root> which is set to WARNING. The call also
+// removes all writers in the DefaultContext and puts the original default
+// writer back as the only writer.
+func ResetLogging() {
+ defaultContext.ResetLoggerLevels()
+ defaultContext.ResetWriters()
+}
+
+// ResetWriters puts the list of writers back into the initial state.
+func ResetWriters() {
+ defaultContext.ResetWriters()
+}
+
+// ReplaceDefaultWriter is a convenience method that does the equivalent of
+// RemoveWriter and then RegisterWriter with the name "default". The previous
+// default writer, if any is returned.
+func ReplaceDefaultWriter(writer Writer) (Writer, error) {
+ return defaultContext.ReplaceWriter(DefaultWriterName, writer)
+}
+
+// RegisterWriter adds the writer to the list of writers in the DefaultContext
+// that get notified when logging. If there is already a registered writer
+// with that name, an error is returned.
+func RegisterWriter(name string, writer Writer) error {
+ return defaultContext.AddWriter(name, writer)
+}
+
+// RemoveWriter removes the Writer identified by 'name' and returns it.
+// If the Writer is not found, an error is returned.
+func RemoveWriter(name string) (Writer, error) {
+ return defaultContext.RemoveWriter(name)
+}
+
+// ConfigureLoggers configures loggers according to the given string
+// specification, which specifies a set of modules and their associated
+// logging levels. Loggers are colon- or semicolon-separated; each
+// module is specified as <modulename>=<level>. White space outside of
+// module names and levels is ignored. The root module is specified
+// with the name "<root>".
+//
+// An example specification:
+// `<root>=ERROR; foo.bar=WARNING`
+func ConfigureLoggers(specification string) error {
+ config, err := ParseConfigString(specification)
+ if err != nil {
+ return err
+ }
+ defaultContext.ApplyConfig(config)
+ return nil
+}
diff --git a/switchq/vendor/github.com/juju/loggo/level.go b/switchq/vendor/github.com/juju/loggo/level.go
new file mode 100644
index 0000000..f6a5c4f
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/level.go
@@ -0,0 +1,102 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import (
+ "strings"
+ "sync/atomic"
+)
+
+// The severity levels. Higher values are more considered more
+// important.
+const (
+ UNSPECIFIED Level = iota
+ TRACE
+ DEBUG
+ INFO
+ WARNING
+ ERROR
+ CRITICAL
+)
+
+// Level holds a severity level.
+type Level uint32
+
+// ParseLevel converts a string representation of a logging level to a
+// Level. It returns the level and whether it was valid or not.
+func ParseLevel(level string) (Level, bool) {
+ level = strings.ToUpper(level)
+ switch level {
+ case "UNSPECIFIED":
+ return UNSPECIFIED, true
+ case "TRACE":
+ return TRACE, true
+ case "DEBUG":
+ return DEBUG, true
+ case "INFO":
+ return INFO, true
+ case "WARN", "WARNING":
+ return WARNING, true
+ case "ERROR":
+ return ERROR, true
+ case "CRITICAL":
+ return CRITICAL, true
+ default:
+ return UNSPECIFIED, false
+ }
+}
+
+// String implements Stringer.
+func (level Level) String() string {
+ switch level {
+ case UNSPECIFIED:
+ return "UNSPECIFIED"
+ case TRACE:
+ return "TRACE"
+ case DEBUG:
+ return "DEBUG"
+ case INFO:
+ return "INFO"
+ case WARNING:
+ return "WARNING"
+ case ERROR:
+ return "ERROR"
+ case CRITICAL:
+ return "CRITICAL"
+ default:
+ return "<unknown>"
+ }
+}
+
+// Short returns a five character string to use in
+// aligned logging output.
+func (level Level) Short() string {
+ switch level {
+ case TRACE:
+ return "TRACE"
+ case DEBUG:
+ return "DEBUG"
+ case INFO:
+ return "INFO "
+ case WARNING:
+ return "WARN "
+ case ERROR:
+ return "ERROR"
+ case CRITICAL:
+ return "CRITC"
+ default:
+ return " "
+ }
+}
+
+// get atomically gets the value of the given level.
+func (level *Level) get() Level {
+ return Level(atomic.LoadUint32((*uint32)(level)))
+}
+
+// set atomically sets the value of the receiver
+// to the given level.
+func (level *Level) set(newLevel Level) {
+ atomic.StoreUint32((*uint32)(level), uint32(newLevel))
+}
diff --git a/switchq/vendor/github.com/juju/loggo/logger.go b/switchq/vendor/github.com/juju/loggo/logger.go
new file mode 100644
index 0000000..fbdfd9e
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/logger.go
@@ -0,0 +1,176 @@
+// Copyright 2014 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import (
+ "fmt"
+ "runtime"
+ "time"
+)
+
+// A Logger represents a logging module. It has an associated logging
+// level which can be changed; messages of lesser severity will
+// be dropped. Loggers have a hierarchical relationship - see
+// the package documentation.
+//
+// The zero Logger value is usable - any messages logged
+// to it will be sent to the root Logger.
+type Logger struct {
+ impl *module
+}
+
+func (logger Logger) getModule() *module {
+ if logger.impl == nil {
+ return defaultContext.root
+ }
+ return logger.impl
+}
+
+// Name returns the logger's module name.
+func (logger Logger) Name() string {
+ return logger.getModule().Name()
+}
+
+// LogLevel returns the configured min log level of the logger.
+func (logger Logger) LogLevel() Level {
+ return logger.getModule().level
+}
+
+// EffectiveLogLevel returns the effective min log level of
+// the receiver - that is, messages with a lesser severity
+// level will be discarded.
+//
+// If the log level of the receiver is unspecified,
+// it will be taken from the effective log level of its
+// parent.
+func (logger Logger) EffectiveLogLevel() Level {
+ return logger.getModule().getEffectiveLogLevel()
+}
+
+// SetLogLevel sets the severity level of the given logger.
+// The root logger cannot be set to UNSPECIFIED level.
+// See EffectiveLogLevel for how this affects the
+// actual messages logged.
+func (logger Logger) SetLogLevel(level Level) {
+ logger.getModule().setLevel(level)
+}
+
+// Logf logs a printf-formatted message at the given level.
+// A message will be discarded if level is less than the
+// the effective log level of the logger.
+// Note that the writers may also filter out messages that
+// are less than their registered minimum severity level.
+func (logger Logger) Logf(level Level, message string, args ...interface{}) {
+ logger.LogCallf(2, level, message, args...)
+}
+
+// LogCallf logs a printf-formatted message at the given level.
+// The location of the call is indicated by the calldepth argument.
+// A calldepth of 1 means the function that called this function.
+// A message will be discarded if level is less than the
+// the effective log level of the logger.
+// Note that the writers may also filter out messages that
+// are less than their registered minimum severity level.
+func (logger Logger) LogCallf(calldepth int, level Level, message string, args ...interface{}) {
+ module := logger.getModule()
+ if !module.willWrite(level) {
+ return
+ }
+ // Gather time, and filename, line number.
+ now := time.Now() // get this early.
+ // Param to Caller is the call depth. Since this method is called from
+ // the Logger methods, we want the place that those were called from.
+ _, file, line, ok := runtime.Caller(calldepth + 1)
+ if !ok {
+ file = "???"
+ line = 0
+ }
+ // Trim newline off format string, following usual
+ // Go logging conventions.
+ if len(message) > 0 && message[len(message)-1] == '\n' {
+ message = message[0 : len(message)-1]
+ }
+
+ // To avoid having a proliferation of Info/Infof methods,
+ // only use Sprintf if there are any args, and rely on the
+ // `go vet` tool for the obvious cases where someone has forgotten
+ // to provide an arg.
+ formattedMessage := message
+ if len(args) > 0 {
+ formattedMessage = fmt.Sprintf(message, args...)
+ }
+ module.write(Entry{
+ Level: level,
+ Filename: file,
+ Line: line,
+ Timestamp: now,
+ Message: formattedMessage,
+ })
+}
+
+// Criticalf logs the printf-formatted message at critical level.
+func (logger Logger) Criticalf(message string, args ...interface{}) {
+ logger.Logf(CRITICAL, message, args...)
+}
+
+// Errorf logs the printf-formatted message at error level.
+func (logger Logger) Errorf(message string, args ...interface{}) {
+ logger.Logf(ERROR, message, args...)
+}
+
+// Warningf logs the printf-formatted message at warning level.
+func (logger Logger) Warningf(message string, args ...interface{}) {
+ logger.Logf(WARNING, message, args...)
+}
+
+// Infof logs the printf-formatted message at info level.
+func (logger Logger) Infof(message string, args ...interface{}) {
+ logger.Logf(INFO, message, args...)
+}
+
+// Debugf logs the printf-formatted message at debug level.
+func (logger Logger) Debugf(message string, args ...interface{}) {
+ logger.Logf(DEBUG, message, args...)
+}
+
+// Tracef logs the printf-formatted message at trace level.
+func (logger Logger) Tracef(message string, args ...interface{}) {
+ logger.Logf(TRACE, message, args...)
+}
+
+// IsLevelEnabled returns whether debugging is enabled
+// for the given log level.
+func (logger Logger) IsLevelEnabled(level Level) bool {
+ return logger.getModule().willWrite(level)
+}
+
+// IsErrorEnabled returns whether debugging is enabled
+// at error level.
+func (logger Logger) IsErrorEnabled() bool {
+ return logger.IsLevelEnabled(ERROR)
+}
+
+// IsWarningEnabled returns whether debugging is enabled
+// at warning level.
+func (logger Logger) IsWarningEnabled() bool {
+ return logger.IsLevelEnabled(WARNING)
+}
+
+// IsInfoEnabled returns whether debugging is enabled
+// at info level.
+func (logger Logger) IsInfoEnabled() bool {
+ return logger.IsLevelEnabled(INFO)
+}
+
+// IsDebugEnabled returns whether debugging is enabled
+// at debug level.
+func (logger Logger) IsDebugEnabled() bool {
+ return logger.IsLevelEnabled(DEBUG)
+}
+
+// IsTraceEnabled returns whether debugging is enabled
+// at trace level.
+func (logger Logger) IsTraceEnabled() bool {
+ return logger.IsLevelEnabled(TRACE)
+}
diff --git a/switchq/vendor/github.com/juju/loggo/module.go b/switchq/vendor/github.com/juju/loggo/module.go
new file mode 100644
index 0000000..8153be5
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/module.go
@@ -0,0 +1,61 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+// Do not change rootName: modules.resolve() will misbehave if it isn't "".
+const (
+ rootString = "<root>"
+ defaultRootLevel = WARNING
+ defaultLevel = UNSPECIFIED
+)
+
+type module struct {
+ name string
+ level Level
+ parent *module
+ context *Context
+}
+
+// Name returns the module's name.
+func (module *module) Name() string {
+ if module.name == "" {
+ return rootString
+ }
+ return module.name
+}
+
+func (m *module) willWrite(level Level) bool {
+ if level < TRACE || level > CRITICAL {
+ return false
+ }
+ return level >= m.getEffectiveLogLevel()
+}
+
+func (module *module) getEffectiveLogLevel() Level {
+ // Note: the root module is guaranteed to have a
+ // specified logging level, so acts as a suitable sentinel
+ // for this loop.
+ for {
+ if level := module.level.get(); level != UNSPECIFIED {
+ return level
+ }
+ module = module.parent
+ }
+ panic("unreachable")
+}
+
+// setLevel sets the severity level of the given module.
+// The root module cannot be set to UNSPECIFIED level.
+func (module *module) setLevel(level Level) {
+ // The root module can't be unspecified.
+ if module.name == "" && level == UNSPECIFIED {
+ level = WARNING
+ }
+ module.level.set(level)
+}
+
+func (m *module) write(entry Entry) {
+ entry.Module = m.name
+ m.context.write(entry)
+}
diff --git a/switchq/vendor/github.com/juju/loggo/testwriter.go b/switchq/vendor/github.com/juju/loggo/testwriter.go
new file mode 100644
index 0000000..b20e470
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/testwriter.go
@@ -0,0 +1,40 @@
+// Copyright 2014 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import (
+ "path"
+ "sync"
+)
+
+// TestWriter is a useful Writer for testing purposes. Each component of the
+// logging message is stored in the Log array.
+type TestWriter struct {
+ mu sync.Mutex
+ log []Entry
+}
+
+// Write saves the params as members in the TestLogValues struct appended to the Log array.
+func (writer *TestWriter) Write(entry Entry) {
+ writer.mu.Lock()
+ defer writer.mu.Unlock()
+ entry.Filename = path.Base(entry.Filename)
+ writer.log = append(writer.log, entry)
+}
+
+// Clear removes any saved log messages.
+func (writer *TestWriter) Clear() {
+ writer.mu.Lock()
+ defer writer.mu.Unlock()
+ writer.log = nil
+}
+
+// Log returns a copy of the current logged values.
+func (writer *TestWriter) Log() []Entry {
+ writer.mu.Lock()
+ defer writer.mu.Unlock()
+ v := make([]Entry, len(writer.log))
+ copy(v, writer.log)
+ return v
+}
diff --git a/switchq/vendor/github.com/juju/loggo/writer.go b/switchq/vendor/github.com/juju/loggo/writer.go
new file mode 100644
index 0000000..b3fe3e5
--- /dev/null
+++ b/switchq/vendor/github.com/juju/loggo/writer.go
@@ -0,0 +1,113 @@
+// Copyright 2014 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package loggo
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "path/filepath"
+
+ "github.com/juju/ansiterm"
+)
+
+// DefaultWriterName is the name of the default writer for
+// a Context.
+const DefaultWriterName = "default"
+
+// Writer is implemented by any recipient of log messages.
+type Writer interface {
+ // Write writes a message to the Writer with the given level and module
+ // name. The filename and line hold the file name and line number of the
+ // code that is generating the log message; the time stamp holds the time
+ // the log message was generated, and message holds the log message
+ // itself.
+ Write(entry Entry)
+}
+
+// NewMinLevelWriter returns a Writer that will only pass on the Write calls
+// to the provided writer if the log level is at or above the specified
+// minimum level.
+func NewMinimumLevelWriter(writer Writer, minLevel Level) Writer {
+ return &minLevelWriter{
+ writer: writer,
+ level: minLevel,
+ }
+}
+
+type minLevelWriter struct {
+ writer Writer
+ level Level
+}
+
+// Write writes the log record.
+func (w minLevelWriter) Write(entry Entry) {
+ if entry.Level < w.level {
+ return
+ }
+ w.writer.Write(entry)
+}
+
+type simpleWriter struct {
+ writer io.Writer
+ formatter func(entry Entry) string
+}
+
+// NewSimpleWriter returns a new writer that writes log messages to the given
+// io.Writer formatting the messages with the given formatter.
+func NewSimpleWriter(writer io.Writer, formatter func(entry Entry) string) Writer {
+ if formatter == nil {
+ formatter = DefaultFormatter
+ }
+ return &simpleWriter{writer, formatter}
+}
+
+func (simple *simpleWriter) Write(entry Entry) {
+ logLine := simple.formatter(entry)
+ fmt.Fprintln(simple.writer, logLine)
+}
+
+func defaultWriter() Writer {
+ return NewColorWriter(os.Stderr)
+}
+
+type colorWriter struct {
+ writer *ansiterm.Writer
+}
+
+var (
+ // SeverityColor defines the colors for the levels output by the ColorWriter.
+ SeverityColor = map[Level]*ansiterm.Context{
+ TRACE: ansiterm.Foreground(ansiterm.Default),
+ DEBUG: ansiterm.Foreground(ansiterm.Green),
+ INFO: ansiterm.Foreground(ansiterm.BrightBlue),
+ WARNING: ansiterm.Foreground(ansiterm.Yellow),
+ ERROR: ansiterm.Foreground(ansiterm.BrightRed),
+ CRITICAL: &ansiterm.Context{
+ Foreground: ansiterm.White,
+ Background: ansiterm.Red,
+ },
+ }
+ // LocationColor defines the colors for the location output by the ColorWriter.
+ LocationColor = ansiterm.Foreground(ansiterm.BrightBlue)
+)
+
+// NewColorWriter will write out colored severity levels if the writer is
+// outputting to a terminal.
+func NewColorWriter(writer io.Writer) Writer {
+ return &colorWriter{ansiterm.NewWriter(writer)}
+}
+
+// Write implements Writer.
+func (w *colorWriter) Write(entry Entry) {
+ ts := formatTime(entry.Timestamp)
+ // Just get the basename from the filename
+ filename := filepath.Base(entry.Filename)
+
+ fmt.Fprintf(w.writer, "%s ", ts)
+ SeverityColor[entry.Level].Fprintf(w.writer, entry.Level.Short())
+ fmt.Fprintf(w.writer, " %s ", entry.Module)
+ LocationColor.Fprintf(w.writer, "%s:%d ", filename, entry.Line)
+ fmt.Fprintln(w.writer, entry.Message)
+}