Documentation ¶
Index ¶
- Variables
- type ConsoleLogger
- type Event
- type Invoked
- type Invoking
- type Logger
- type LoggerInitialized
- type OnStartExecuted
- type OnStartExecuting
- type OnStopExecuted
- type OnStopExecuting
- type Provided
- type RolledBack
- type RollingBack
- type Started
- type Stopped
- type Stopping
- type Supplied
- type ZapLogger
Constants ¶
This section is empty.
Variables ¶
var NopLogger = nopLogger{}
NopLogger is an Fx event logger that ignores all messages.
Functions ¶
This section is empty.
Types ¶
type ConsoleLogger ¶
ConsoleLogger is an Fx event logger that attempts to write human-readable mesasges to the console.
Use this during development.
func (*ConsoleLogger) LogEvent ¶
func (l *ConsoleLogger) LogEvent(event Event)
LogEvent logs the given event to the provided Zap logger.
type Event ¶
type Event interface {
// contains filtered or unexported methods
}
Event defines an event emitted by fx.
type Invoked ¶
type Invoked struct { // Functionname is the name of the function that was invoked. FunctionName string // Err is non-nil if the function failed to execute. Err error // Trace records information about where the fx.Invoke call was made. // Note that this is NOT a stack trace of the error itself. Trace string }
Invoked is emitted after we invoke a function specified with fx.Invoke, whether it succeded or failed.
type Invoking ¶
type Invoking struct { // FunctionName is the name of the function that will be invoked. FunctionName string }
Invoking is emitted before we invoke a function specified with fx.Invoke.
type Logger ¶
type Logger interface { // LogEvent is called when a logging event is emitted. LogEvent(Event) }
Logger defines interface used for logging.
type LoggerInitialized ¶
type LoggerInitialized struct { // ConstructorName is the name of the constructor that builds this // logger. ConstructorName string // Err is non-nil if the logger failed to build. Err error }
LoggerInitialized is emitted when a logger supplied with fx.WithLogger is instantiated, or if it fails to instantiate.
type OnStartExecuted ¶
type OnStartExecuted struct { // FunctionName is the name of the function that was executed. FunctionName string // CallerName is the name of the function that scheduled the hook for // execution. CallerName string // Method specifies the kind of the hook. This is one of "OnStart" and // "OnStop". Method string // Runtime specifies how long it took to run this hook. Runtime time.Duration // Err is non-nil if the hook failed to execute. Err error }
OnStartExecuted is emitted after an OnStart hook has been executed.
type OnStartExecuting ¶
type OnStartExecuting struct { // FunctionName is the name of the function that will be executed. FunctionName string // CallerName is the name of the function that scheduled the hook for // execution. CallerName string }
OnStartExecuting is emitted before an OnStart hook is exeucted.
type OnStopExecuted ¶
type OnStopExecuted struct { // FunctionName is the name of the function that was executed. FunctionName string // CallerName is the name of the function that scheduled the hook for // execution. CallerName string // Runtime specifies how long it took to run this hook. Runtime time.Duration // Err is non-nil if the hook failed to execute. Err error }
OnStopExecuted is emitted after an OnStop hook has been executed.
type OnStopExecuting ¶
type OnStopExecuting struct { // FunctionName is the name of the function that will be executed. FunctionName string // CallerName is the name of the function that scheduled the hook for // execution. CallerName string }
OnStopExecuting is emitted before an OnStop hook is exeucted.
type Provided ¶
type Provided struct { // ConstructorName is the name of the constructor that was provided to // Fx. ConstructorName string // OutputTypeNames is a list of names of types that are produced by // this constructor. OutputTypeNames []string // Err is non-nil if we failed to provide this constructor. Err error }
Provided is emitted when a constructor is provided to Fx.
type RolledBack ¶
type RolledBack struct { // Err is non-nil if the rollback failed. Err error }
RolledBack is emitted after a service has been rolled back, whether it succeded or not.
type RollingBack ¶
type RollingBack struct { // StartErr is the error that caused this rollback. StartErr error }
RollingBack is emitted when the application failed to start up due to an error, and is being rolled back.
type Started ¶
type Started struct { // Err is non-nil if the application failed to start successfully. Err error }
Started is emitted when an application is started successfully and/or it errored.
type Stopped ¶
type Stopped struct { // Err is non-nil if errors were encountered during shutdown. Err error }
Stopped is emitted when the application has finished shutting down, whether successfully or not.
type Stopping ¶
Stopping is emitted when the application receives a signal to shut down after starting. This may happen with fx.Shutdowner or by sending a signal to the application on the command line.