Add debug
This commit is contained in:
parent
83232e17d7
commit
9e79d2b3aa
11
encoder.go
11
encoder.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"log"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
|
||||
@ -31,6 +32,11 @@ func NewGenericTemplateBasedEncoder(templateDir string, service *descriptor.Serv
|
||||
templateDir: templateDir,
|
||||
debug: debug,
|
||||
}
|
||||
|
||||
if debug {
|
||||
log.Printf("new encoder: file=%q service=%q template-dir=%q", templateDir, service.GetName(), file.GetName())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -55,6 +61,9 @@ func (e *GenericTemplateBasedEncoder) templates() ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if e.debug {
|
||||
log.Printf("new template: %q", rel)
|
||||
}
|
||||
|
||||
filenames = append(filenames, rel)
|
||||
}
|
||||
@ -89,7 +98,7 @@ func (e *GenericTemplateBasedEncoder) Files() []*plugin_go.CodeGeneratorResponse
|
||||
|
||||
templates, err := e.templates()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Fatalf("cannot get templates from %q: %v", e.templateDir, err)
|
||||
}
|
||||
|
||||
for _, templateFilename := range templates {
|
||||
|
Loading…
x
Reference in New Issue
Block a user