Exemple #1
0
func (c *Client) FromContext(ctx scope.Context) bool {
	var k clientKey
	src, ok := ctx.Get(k).(*Client)
	if !ok || src == nil {
		return false
	}
	*c = *src
	return true
}
Exemple #2
0
func GetLogger(ctx scope.Context) *logrus.Logger {
	return ctx.Get(loggerKey).(*logrus.Logger)
}
Exemple #3
0
func Logger(ctx scope.Context) *log.Logger {
	if logger, ok := ctx.Get(logCtx).(*log.Logger); ok {
		return logger
	}
	return log.New(os.Stdout, "[???] ", logFlags)
}