Documentation ¶
Index ¶
- Variables
- func CaptureLogs(c chan<- Param)
- func DecodeOther(other, cc interface{}) error
- func DefaultPort(conn string, port int) string
- func DefaultScheme(uri, scheme string) string
- func Flusher() flush
- func FormatValue(format string, val interface{}) string
- func GetNextOccurrence(weekdays []int, timeStr string, tz string) (time.Time, error)
- func Getenv(key string, def ...string) string
- func LocalIPs() (ips []net.IPNet)
- func LogLevel(defaultLevel string, areaLevels map[string]string)
- func Loggers(cb func(string, *Logger))
- func NewConfigError(err error) error
- func ParseDuration(s string) (time.Duration, error)
- func RedactDefaultHook(s string) []string
- func ReplaceFormatted(s string, kv map[string]interface{}) (string, error)
- func SignFromPower(current, power float64) float64
- func TokenWithExpiry(token *oauth2.Token) *oauth2.Token
- func WithLogger(ctx context.Context, log *Logger) context.Context
- type AuthCollection
- type AuthProvider
- type Cache
- type ConfigError
- type Logger
- type Monitor
- type Param
- type Queue
- type Redactor
- type State
- type Tee
- type TeeAttacher
Constants ¶
This section is empty.
Variables ¶
var ( // RedactReplacement is the default replacement string RedactReplacement = "***" // RedactHook is the hook for expanding different representations of // redaction items. Setting to nil will disable redaction. RedactHook = RedactDefaultHook )
var CtxLogger = struct{}{}
var ErrStateExpired = fmt.Errorf("state expired")
var LogAreaPadding = 6
LogAreaPadding of log areas
var ( // OutThreshold is the default console log level OutThreshold = jww.LevelInfo )
Functions ¶
func CaptureLogs ¶
func CaptureLogs(c chan<- Param)
CaptureLogs appends uiWriter to relevant log levels for loggers created before uiChan is initialized
func DecodeOther ¶
func DecodeOther(other, cc interface{}) error
DecodeOther uses mapstructure to decode into target structure. Unused keys cause errors.
func DefaultPort ¶
DefaultPort appends given port to connection if not specified
func DefaultScheme ¶
DefaultScheme prepends given scheme to uri if not specified
func FormatValue ¶
FormatValue will apply specific formatting in addition to standard sprintf
func GetNextOccurrence ¶
GetNextOccurrence returns the next occurrence of the given time on the specified weekdays.
func NewConfigError ¶
func RedactDefaultHook ¶
RedactDefaultHook expands a redaction item to include URL encoding
func ReplaceFormatted ¶
ReplaceFormatted replaces all occurrences of ${key} with formatted val from the kv map
func SignFromPower ¶
SignFromPower is a helper function to create signed current from signed power bypassing already signed current
Types ¶
type AuthCollection ¶
type AuthCollection struct {
// contains filtered or unexported fields
}
func NewAuthCollection ¶
func NewAuthCollection(paramC chan<- Param) *AuthCollection
func (*AuthCollection) Register ¶
func (ac *AuthCollection) Register(baseURI, title string) *AuthProvider
type AuthProvider ¶
type AuthProvider struct { Uri string `json:"uri"` Authenticated bool `json:"authenticated"` // contains filtered or unexported fields }
func (*AuthProvider) Handler ¶
func (ap *AuthProvider) Handler() chan<- bool
type ConfigError ¶
type ConfigError struct {
// contains filtered or unexported fields
}
ConfigError wraps yaml configuration errors from mapstructure
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
func (*ConfigError) Unwrap ¶
func (e *ConfigError) Unwrap() error
type Logger ¶
Logger wraps a jww notepad to avoid leaking implementation detail
func NewLoggerWithLoadpoint ¶
NewLoggerWithLoadpoint creates a logger with reference to at loadpoint
type Monitor ¶
type Monitor[T any] struct { // contains filtered or unexported fields }
Monitor monitors values for regular updates
func NewMonitor ¶
NewMonitor created a new monitor with given timeout
func (*Monitor[T]) Done ¶
func (m *Monitor[T]) Done() <-chan struct{}
Done signals if monitor has been updated at least once
func (*Monitor[T]) GetFunc ¶
GetFunc returns the current value or ErrOutdated if timeout exceeded while holding the lock
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
Queue is based on https://github.com/golang-ds/queue
func (*Queue[T]) Dequeue ¶
Dequeue removes and returns the front element of the queue. It returns false if the queue was empty.
func (*Queue[T]) Enqueue ¶
func (q *Queue[T]) Enqueue(data T)
Enqueue adds an element to the end of the queue.
func (*Queue[T]) First ¶
First returns the front element of the queue. It returns false if the queue was empty.
type Redactor ¶
type Redactor struct {
// contains filtered or unexported fields
}
Redactor implements log redaction
type Tee ¶
type Tee struct {
// contains filtered or unexported fields
}
Tee distributes parameters to subscribers
type TeeAttacher ¶
type TeeAttacher interface {
Attach() <-chan Param
}
TeeAttacher allows attaching a listener to a tee
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package shortrfc3339 implements helpers for working with shortened RFC-3339 compliant timestamps (those without seconds).
|
Package shortrfc3339 implements helpers for working with shortened RFC-3339 compliant timestamps (those without seconds). |
Package urlvalues provides functions for working with url.Values
|
Package urlvalues provides functions for working with url.Values |