Documentation ¶
Index ¶
Constants ¶
const LogCallWithContextDescription = `` /* 761-byte string literal not displayed */
LogCallWithContextDescription documents LogCallWithContext.
const SimpleLogCallDescription = `` /* 133-byte string literal not displayed */
SimpleLogCallDescription documents SimpleLogCall.
Variables ¶
This section is empty.
Functions ¶
func CallGenerators ¶
func CallGenerators() []string
CallGenerators lists all of the available CallGenerators.
func RegisterCallGenerator ¶
func RegisterCallGenerator(callGenerator CallGenerator)
RegisterCallGenerator registers a new function call generator.
Types ¶
type CallGenerator ¶
type CallGenerator interface { // UnmarshalYAML unmarshals the annotator's yaml configuration. UnmarshalYAML(buf []byte) error // Import returns the import path for the function to be generated by // Generate. Import() string // Generate creates the appropriate call code and import path for // the function to be used as an annotation. Generate(*token.FileSet, *types.Func, *ast.FuncDecl) (string, error) // Describe returns a description for the function annotation. Describe() string }
CallGenerator represents the ability to generate code for a function call using arguments taken from a function call signature.
func Lookup ¶
func Lookup(typeName string) CallGenerator
Lookup returns the CallGenerator, if any, with the specified type.
type EssentialOptions ¶
type EssentialOptions struct { Type string `yaml:"type" annotator:"name of annotator type."` ImportPath string `yaml:"importPath" annotator:"import path for the logging function."` FunctionName string `yaml:"functionName" annotator:"name of the function to be invoked."` }
EssentialOptions represents the configuration options required for all function generators.
type LogCallWithContext ¶
type LogCallWithContext struct { EssentialOptions `yaml:",inline"` ContextType string `yaml:"contextType" annotator:"type for the context parameter and result."` }
LogCallWithContext represents a function call generator for a logging call with the following signature:
func (ctx <contextType>, functionName, callerLocation, format string, arguments ...interface{}) func(ctx <contextType>, format string, namedResults ...interface{})
See LogCallWithContextDescription for a complete description.
func (*LogCallWithContext) Describe ¶
func (lc *LogCallWithContext) Describe() string
Describe implements functions.CallGenerator.
func (*LogCallWithContext) Import ¶
func (lc *LogCallWithContext) Import() string
Import implements functions.CallGenerator.
func (*LogCallWithContext) UnmarshalYAML ¶
func (lc *LogCallWithContext) UnmarshalYAML(buf []byte) error
UnmarshalYAML implements functions.CallGenerator.
type SimpleLogCall ¶
type SimpleLogCall struct { EssentialOptions `yaml:",inline"` ContextType string `yaml:"contextType" annotator:"type for the context parameter and result."` }
SimpleLogCall represents a function call generator for a logging call with the same signature as log.Callf and fmt.Printf.
func (*SimpleLogCall) Describe ¶
func (sl *SimpleLogCall) Describe() string
Describe implements functions.CallGenerator.
func (*SimpleLogCall) Import ¶
func (sl *SimpleLogCall) Import() string
Import implements functions.CallGenerator.
func (*SimpleLogCall) UnmarshalYAML ¶
func (sl *SimpleLogCall) UnmarshalYAML(buf []byte) error
UnmarshalYAML implements functions.CallGenerator.