Open flbn opened 1 year ago
also, this is separate but how do we feel about using a struct instead of this global variable?
like, instead of this:
var ( runtimeAPI = os.Getenv("AWS_LAMBDA_RUNTIME_API") extensionName = filepath.Base(os.Args[0]) isFirstInvocation = true runtimeDone = make(chan struct{}) // API Port logsPort = "8080" // Buffering Config defaultMaxItems = 1000 defaultMaxBytes = 262144 defaultTimeoutMS = 1000 developmentMode = false logger *zap.Logger )
something more like:
type Config struct { RuntimeAPI string ExtensionName string IsFirstInvocation bool LogsPort string MaxItems int MaxBytes int TimeoutMS int DevelopmentMode bool Logger *zap.Logger RuntimeDone chan struct{} } var cfg = Config{ RuntimeAPI: os.Getenv("AWS_LAMBDA_RUNTIME_API"), ExtensionName: filepath.Base(os.Args[0]), IsFirstInvocation: true, LogsPort: "8080", MaxItems: 1000, MaxBytes: 262144, TimeoutMS: 1000, DevelopmentMode: false, RuntimeDone: make(chan struct{}), }
and then used like
cfg.Logger.Error('ex')
Originally posted by @flbn in https://github.com/axiomhq/axiom-lambda-extension/issues/17#issuecomment-1737615992
like, instead of this:
something more like:
and then used like
Originally posted by @flbn in https://github.com/axiomhq/axiom-lambda-extension/issues/17#issuecomment-1737615992