diff --git a/encoder.go b/encoder.go index 99e4644..31544d9 100644 --- a/encoder.go +++ b/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 {