Prettify logs
This commit is contained in:
parent
d1d581bd75
commit
6bc8160f99
|
@ -46,7 +46,7 @@ func New(configPath string) (*Server, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. log configuration services
|
// 4. log configuration services
|
||||||
log.Printf("=== Aicra configuration ===\n")
|
log.Printf("🔧 Reading configuration '%s'\n", configPath)
|
||||||
logService(*i.services, "")
|
logService(*i.services, "")
|
||||||
|
|
||||||
return i, nil
|
return i, nil
|
||||||
|
@ -68,9 +68,9 @@ func (s *Server) Handle(handler *api.Handler) {
|
||||||
func (s Server) HTTP() httpServer {
|
func (s Server) HTTP() httpServer {
|
||||||
|
|
||||||
// 1. log available handlers
|
// 1. log available handlers
|
||||||
log.Printf("=== Mapped handlers ===\n")
|
log.Printf("🔗 Mapping handlers\n")
|
||||||
for i := 0; i < len(s.handlers); i++ {
|
for i := 0; i < len(s.handlers); i++ {
|
||||||
log.Printf("* [rest] %s\t'%s'\n", s.handlers[i].GetMethod(), s.handlers[i].GetPath())
|
log.Printf(" ->\t%s\t'%s'\n", s.handlers[i].GetMethod(), s.handlers[i].GetPath())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. cast to http server
|
// 2. cast to http server
|
||||||
|
|
4
util.go
4
util.go
|
@ -90,9 +90,9 @@ func logService(s config.Service, path string) {
|
||||||
for _, method := range handledMethods {
|
for _, method := range handledMethods {
|
||||||
if m := s.Method(method); m != nil {
|
if m := s.Method(method); m != nil {
|
||||||
if path == "" {
|
if path == "" {
|
||||||
log.Printf("* [rest] %s\t'/'\n", method)
|
log.Printf(" ->\t%s\t'/'\n", method)
|
||||||
} else {
|
} else {
|
||||||
log.Printf("* [rest] %s\t'%s'\n", method, path)
|
log.Printf(" ->\t%s\t'%s'\n", method, path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue