// Logger is middleware that logs the request
350939
func Logger(logger chronograf.Logger, next http.Handler) http.Handler {
	fn := func(w http.ResponseWriter, r *http.Request) {
		now := time.Now()
		logger.WithField("component", "server").
			WithField("remote_addr", r.RemoteAddr).
			WithField("method", r.Method).
			WithField("url", r.URL).
			Debug("Request")

		sw := &statusWriter{
			ResponseWriter: w,
		}
		if f, ok := w.(http.Flusher); ok {
			sw.Flusher = f
		}
		next.ServeHTTP(sw, r)
		later := time.Now()
		elapsed := later.Sub(now)

		logger.
			WithField("component", "server").
			WithField("remote_addr", r.RemoteAddr).
			WithField("method", r.Method).
			WithField("response_time", elapsed.String()).
			WithField("status", sw.Status()).
			Info("Response: ", http.StatusText(sw.Status()))
	}
	return http.HandlerFunc(fn)
}
831294
func (e *ErrorLogLogger) ErrorLogger(err error) Logger {
	return e.ErrHandler.ErrorLogger(err)
}
69221
func RequestLoggerHandler(c *gin.Context) {
	if c.Request != nil {

		buf, _ := ioutil.ReadAll(c.Request.Body)
		c.Request.Body.Close()

		log.Println("-----------------------------------------------------------------------------------------------------")
		log.Println("REQUEST HEADERS:")
		for k, v := range c.Request.Header {
			log.Printf("\t%s: %s\n", k, v)
		}
		log.Printf("\nREQUEST BODY:\n%s\n", buf)
		log.Println("-----------------------------------------------------------------------------------------------------")

		c.Request.Body = ioutil.NopCloser(bytes.NewReader(buf))
	}
	c.Next()
}
1247290
func (c *ChannelLogger) ErrorLogger(err error) Logger {
	c.Err <- err
	return c
}
625467
func NewLogger() *Logger {
	logger := &coreLogger{
		ErrorWriter: os.Stderr,
		BufferSize:  1024,
		MaxLevel:    LevelDebug,
		Targets:     make([]Target, 0),
	}
	return &Logger{logger, "app", DefaultFormatter}
}
1216173
func NewLoggingHandler(
	w io.Writer,
	logHTTPRequests, logHTTPResponses bool) types.Middleware {

	return &loggingHandler{
		writer:       w,
		logRequests:  logHTTPRequests,
		logResponses: logHTTPResponses,
	}
}
444977
func responseLogger(c *Client, res *Response) error {
	if c.Debug {
		rl := &ResponseLog{Header: copyHeaders(res.Header()), Body: res.fmtBodyString(c.debugBodySizeLimit)}
		if c.responseLog != nil {
			if err := c.responseLog(rl); err != nil {
				return err
			}
		}

		resLog := "\n---------------------- RESPONSE LOG -----------------------\n" +
			fmt.Sprintf("STATUS 		: %s\n", res.Status()) +
			fmt.Sprintf("RECEIVED AT	: %v\n", res.ReceivedAt().Format(time.RFC3339Nano)) +
			fmt.Sprintf("RESPONSE TIME	: %v\n", res.Time()) +
			"HEADERS:\n" +
			composeHeaders(rl.Header) + "\n"
		if res.Request.isSaveResponse {
			resLog += fmt.Sprintf("BODY   :\n***** RESPONSE WRITTEN INTO FILE *****\n")
		} else {
			resLog += fmt.Sprintf("BODY   :\n%v\n", rl.Body)
		}
		resLog += "----------------------------------------------------------\n"

		c.Log.Print(resLog)
	}

	return nil
}
1143020
func (m Middleware) RequestIDLogger(next http.Handler) http.Handler {
	fn := func(w http.ResponseWriter, r *http.Request) {
		requestID := chimiddleware.GetReqID(r.Context())
		derivedLogger := m.Log.With(zap.String("request_id", requestID))
		r = r.WithContext(context.WithValue(r.Context(), CtxLoggerKey, derivedLogger))
		next.ServeHTTP(w, r)
	}

	return http.HandlerFunc(fn)
}
868931
func Logger(args ...string) logger.Logger {
	var name string
	if len(args) > 0 {
		name = args[0]
	} else {
		name = ""
	}

	if global == nil {
		global = logger.New("")
		global.SetLevel(levels.DEBUG)
	}

	l := global.GetLogger(name)

	return l
}
485679
func Logger(ctx context.Context) log15.Logger {
	logger := goa.ContextLogger(ctx)
	if a, ok := logger.(*adapter); ok {
		return a.Logger
	}
	return nil
}
1350711
func SimpleLogger(name string) (*Logger, error) {
	return createLogger(name, WARNING, BasicFormat, DefaultTimeFormat, os.Stdout, false)
}
536453
func NewLogger() *Logger {
	logger := &Logger{*log.New(os.Stdout, "", log.LstdFlags), false, false}
	return logger
}
1155124
func Logger(logger *zap.Logger) Option {
	return optionFunc(func(opts *options) {
		opts.logger = logger
	})
}
1128290
func (l LoggerStruct) NewLogger() LoggerStruct {
	new := LoggerStruct{}
	new.logger = l.logger.New()
	new.handler = l.handler
	new.inDebug = l.inDebug
	new.processPid = l.processPid

	return new
}
11012
func Logger(logger *zap.Logger) TransportOption {
	return func(t *transportOptions) {
		t.logger = logger
	}
}
1072782
func Logger(l *log.Logger) ConnLimitOption {
	return func(cl *ConnLimiter) error {
		cl.log = l
		return nil
	}
}
58273
func NewLogger(p Priority, logFlag int) (*log.Logger, error) {
	s, err := New(p, "")
	if err != nil {
		return nil, err
	}
	return log.New(s, "", logFlag), nil
}