func (c *Client) FromRequest(ctx scope.Context, r *http.Request) { c.UserAgent = r.Header.Get("User-Agent") c.Connected = time.Now() c.IP = getIP(r) var k clientKey ctx.Set(k, c) }
func SetLogger(ctx scope.Context, logger *logrus.Logger) { ctx.Set(loggerKey, logger) }
func LoggingContext(ctx scope.Context, prefix string) scope.Context { logger := log.New(os.Stdout, prefix, logFlags) ctx.Set(logCtx, logger) return ctx }
func LoggingContext(ctx scope.Context, w io.Writer, prefix string) scope.Context { logger := log.New(w, prefix, logFlags) ctx.Set(logCtx, logger) return ctx }