mock

package
v0.0.0-...-545971b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger represents a logger.

func (*Logger) Debug

func (l *Logger) Debug(format string, v ...interface{})

Debug is equivalent to log.Printf() + "\n" if format is not empty. It's equivalent to Println() if format is empty.

func (*Logger) Error

func (l *Logger) Error(format string, v ...interface{})

Error is equivalent to log.Printf() + "\n" if format is not empty. It's equivalent to Println() if format is empty.

func (*Logger) Fatal

func (l *Logger) Fatal(format string, v ...interface{})

Fatal is equivalent to log.Printf() + "\n" if format is not empty. It's equivalent to Println() if format is empty. It's followed by a call to os.Exit(1).

func (*Logger) Info

func (l *Logger) Info(format string, v ...interface{})

Info is equivalent to log.Printf() + "\n" if format is not empty. It's equivalent to Println() if format is empty.

func (*Logger) Log

func (l *Logger) Log(level ambient.LogLevel, format string, v ...interface{})

Log is equivalent to log.Printf() + "\n" if format is not empty. It's equivalent to Println() if format is empty.

func (*Logger) Name

func (l *Logger) Name() string

Name returns the name of the logger.

func (*Logger) Named

func (l *Logger) Named(name string) ambient.AppLogger

Named returns a new logger with the appended name, linked to the existing logger.

func (*Logger) SetLogLevel

func (l *Logger) SetLogLevel(level ambient.LogLevel)

SetLogLevel will set the logger output level.

func (*Logger) Warn

func (l *Logger) Warn(format string, v ...interface{})

Warn is equivalent to log.Printf() + "\n" if format is not empty. It's equivalent to Println() if format is empty.

type LoggerPlugin

type LoggerPlugin struct {
	// contains filtered or unexported fields
}

LoggerPlugin represents an Ambient plugin.

func NewLoggerPlugin

func NewLoggerPlugin(optionalWriter io.Writer) *LoggerPlugin

NewLoggerPlugin returns an Ambient plugin that provides logging using the standard logger.

func (*LoggerPlugin) Logger

func (p *LoggerPlugin) Logger(appName string, appVersion string, optionalWriter io.Writer) (ambient.AppLogger, error)

Logger returns a logger.

func (*LoggerPlugin) NewLogger

func (p *LoggerPlugin) NewLogger(appName string, appVersion string, optionalWriter io.Writer) *Logger

NewLogger returns a new logger with a default log level of error.

func (*LoggerPlugin) PluginName

func (p *LoggerPlugin) PluginName() string

PluginName returns the plugin name.

func (*LoggerPlugin) PluginVersion

func (p *LoggerPlugin) PluginVersion() string

PluginVersion returns the plugin version.

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

MemoryStore represents a file in memory.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore returns a local filesystem object with a file path.

func (*MemoryStore) Load

func (s *MemoryStore) Load() ([]byte, error)

Load returns a file contents from the filesystem.

func (*MemoryStore) Save

func (s *MemoryStore) Save(b []byte) error

Save writes a file to the filesystem and returns an error if one occurs.

type Plugin

type Plugin struct {
	*ambient.PluginBase

	MockGrants []ambient.GrantRequest
	MockRoutes func(p *ambient.PluginBase)
	// contains filtered or unexported fields
}

Plugin represents an Ambient plugin.

func NewPlugin

func NewPlugin(name string, version string) *Plugin

NewPlugin returns a new mock plugin.

func (*Plugin) GrantRequests

func (p *Plugin) GrantRequests() []ambient.GrantRequest

GrantRequests returns a list of grants requested by the plugin.

func (*Plugin) PluginName

func (p *Plugin) PluginName() string

PluginName returns the plugin name.

func (*Plugin) PluginVersion

func (p *Plugin) PluginVersion() string

PluginVersion returns the plugin version.

func (*Plugin) Routes

func (p *Plugin) Routes()

Routes gets routes for the plugin.

type StoragePlugin

type StoragePlugin struct{}

StoragePlugin represents an Ambient plugin.

func NewStoragePlugin

func NewStoragePlugin() *StoragePlugin

NewStoragePlugin returns an Ambient plugin that provides memory storage.

func (*StoragePlugin) PluginName

func (p *StoragePlugin) PluginName() string

PluginName returns the plugin name.

func (*StoragePlugin) PluginVersion

func (p *StoragePlugin) PluginVersion() string

PluginVersion returns the plugin version.

func (*StoragePlugin) Storage

Storage returns data and session storage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL