Welcome to mirror list, hosted at ThFree Co, Russian Federation.

logging.go - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 26b49b6d2e14bfb27a4bd65e940c6af900ed6aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main

import (
	log "github.com/sirupsen/logrus"
)

var (
	accessLogFormat = "text"
)

func configureLogging(format string, verbose bool) {
	if verbose {
		log.SetLevel(log.DebugLevel)
	}

	switch format {
	case "json":
		log.SetFormatter(&log.JSONFormatter{})
		accessLogFormat = "json"
	default:
		log.SetFormatter(&log.TextFormatter{})
		accessLogFormat = "text"
	}
}

func fatal(err error) {
	log.WithError(err).Fatal()
}