Prettify logs

This commit is contained in:
Adrien Marquès 2019-11-19 19:19:55 +01:00
parent d1d581bd75
commit 6bc8160f99
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
2 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ func New(configPath string) (*Server, error) {
}
// 4. log configuration services
log.Printf("=== Aicra configuration ===\n")
log.Printf("🔧 Reading configuration '%s'\n", configPath)
logService(*i.services, "")
return i, nil
@ -68,9 +68,9 @@ func (s *Server) Handle(handler *api.Handler) {
func (s Server) HTTP() httpServer {
// 1. log available handlers
log.Printf("=== Mapped handlers ===\n")
log.Printf("🔗 Mapping handlers\n")
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

View File

@ -90,9 +90,9 @@ func logService(s config.Service, path string) {
for _, method := range handledMethods {
if m := s.Method(method); m != nil {
if path == "" {
log.Printf("* [rest] %s\t'/'\n", method)
log.Printf(" ->\t%s\t'/'\n", method)
} else {
log.Printf("* [rest] %s\t'%s'\n", method, path)
log.Printf(" ->\t%s\t'%s'\n", method, path)
}
}
}