This commit is contained in:
Makis Maropoulos 2016-06-18 01:11:03 +03:00
parent 5d369b7c73
commit 5060cf4f5e
6 changed files with 15 additions and 11 deletions

View File

@ -9,6 +9,7 @@ import (
"os" "os"
) )
// DefaultLoggerPrefix is the prefix (expect the [IRIS]), is empty for now
const DefaultLoggerPrefix = "" const DefaultLoggerPrefix = ""
var ( var (

View File

@ -1240,7 +1240,7 @@ func (mux *serveMux) build() {
} }
} }
// I decide that it's better to explicit give subdomain and a path to it than registedPath(mysubdomain./something) now its: subdomain: mysubdomain., path: /something // I decide that it's better to explicit give subdomain and a path to it than registedPath(mysubdomain./something) now its: subdomain: mysubdomain., path: /something
// we have different tree for each of subdomains, now you can use everyting you can use with the normal paths ( before you couldn't set /any/*path) // we have different tree for each of subdomains, now you can use everything you can use with the normal paths ( before you couldn't set /any/*path)
if err := tree.entry.add(r.path, r.middleware); err != nil { if err := tree.entry.add(r.path, r.middleware); err != nil {
mux.logger.Panic(err.Error()) mux.logger.Panic(err.Error())
} }

View File

@ -320,7 +320,7 @@ func (s *Framework) Close() {
s.Must(s.CloseWithErr()) s.Must(s.CloseWithErr())
} }
// MustUse registers Handler middleware to the beggining, prepends them instead of append // MustUse registers Handler middleware to the beginning, prepends them instead of append
// //
// Use it when you want to add a global middleware to all parties, to all routes in all subdomains // Use it when you want to add a global middleware to all parties, to all routes in all subdomains
// It can be called after other, (but before .Listen of course) // It can be called after other, (but before .Listen of course)
@ -328,7 +328,7 @@ func MustUse(handlers ...Handler) {
Default.MustUse(handlers...) Default.MustUse(handlers...)
} }
// MustUseFunc registers HandlerFunc middleware to the beggining, prepends them instead of append // MustUseFunc registers HandlerFunc middleware to the beginning, prepends them instead of append
// //
// Use it when you want to add a global middleware to all parties, to all routes in all subdomains // Use it when you want to add a global middleware to all parties, to all routes in all subdomains
// It can be called after other, (but before .Listen of course) // It can be called after other, (but before .Listen of course)
@ -336,7 +336,7 @@ func MustUseFunc(handlersFn ...HandlerFunc) {
Default.MustUseFunc(handlersFn...) Default.MustUseFunc(handlersFn...)
} }
// MustUse registers Handler middleware to the beggining, prepends them instead of append // MustUse registers Handler middleware to the beginning, prepends them instead of append
// //
// Use it when you want to add a global middleware to all parties, to all routes in all subdomains // Use it when you want to add a global middleware to all parties, to all routes in all subdomains
// It can be called after other, (but before .Listen of course) // It can be called after other, (but before .Listen of course)
@ -346,7 +346,7 @@ func (s *Framework) MustUse(handlers ...Handler) {
} }
} }
// MustUseFunc registers HandlerFunc middleware to the beggining, prepends them instead of append // MustUseFunc registers HandlerFunc middleware to the beginning, prepends them instead of append
// //
// Use it when you want to add a global middleware to all parties, to all routes in all subdomains // Use it when you want to add a global middleware to all parties, to all routes in all subdomains
// It can be called after other, (but before .Listen of course) // It can be called after other, (but before .Listen of course)

View File

@ -52,19 +52,19 @@ func (l *Logger) ResetColors() {
// PrintBanner prints a text (banner) with BannerFgColor, BannerBgColor and a success message at the end // PrintBanner prints a text (banner) with BannerFgColor, BannerBgColor and a success message at the end
// It doesn't cares if the logger is disabled or not, it will print this // It doesn't cares if the logger is disabled or not, it will print this
func (l *Logger) PrintBanner(banner string, sucessMessage string) { func (l *Logger) PrintBanner(banner string, successMessage string) {
c := color.New(attr(l.config.ColorBgDefault), attr(l.config.ColorFgBanner), color.Bold) c := color.New(attr(l.config.ColorBgDefault), attr(l.config.ColorFgBanner), color.Bold)
c.Println(banner) c.Println(banner)
bannersRan++ bannersRan++
if sucessMessage != "" { if successMessage != "" {
c.Add(attr(l.config.ColorBgSuccess), attr(l.config.ColorFgSuccess), color.Bold) c.Add(attr(l.config.ColorBgSuccess), attr(l.config.ColorFgSuccess), color.Bold)
if bannersRan > 1 { if bannersRan > 1 {
c.Printf("Server[%#v]\n", bannersRan) c.Printf("Server[%#v]\n", bannersRan)
} }
c.Println(sucessMessage) c.Println(successMessage)
} }
c.DisableColor() c.DisableColor()
@ -120,9 +120,9 @@ func (l *Logger) Panicf(format string, a ...interface{}) {
panic("") panic("")
} }
// Sucessf calls l.Output to print to the logger with the Success colors. // Successf calls l.Output to print to the logger with the Success colors.
// Arguments are handled in the manner of fmt.Printf. // Arguments are handled in the manner of fmt.Printf.
func (l *Logger) Sucessf(format string, a ...interface{}) { func (l *Logger) Successf(format string, a ...interface{}) {
if !l.config.Disabled { if !l.config.Disabled {
l.underline.Add(attr(l.config.ColorBgSuccess), attr(l.config.ColorFgSuccess)) l.underline.Add(attr(l.config.ColorBgSuccess), attr(l.config.ColorFgSuccess))
l.Printf(format, a...) l.Printf(format, a...)

View File

@ -82,7 +82,7 @@ func (l *loggerMiddleware) printf(format string, a ...interface{}) {
} }
} }
// Default returns the logger middleware as Handler with the default settings // New returns the logger middleware as HandlerFunc with the default settings if second parameter is not passed
func New(theLogger *logger.Logger, options ...Options) iris.HandlerFunc { func New(theLogger *logger.Logger, options ...Options) iris.HandlerFunc {
if theLogger == nil { if theLogger == nil {
theLogger = logger.New(config.DefaultLogger()) theLogger = logger.New(config.DefaultLogger())

View File

@ -160,6 +160,9 @@ func (s *Engine) buildFromAsset() error {
if s.Config.Engine == config.JadeEngine { if s.Config.Engine == config.JadeEngine {
contents, err = jade.Parse(name, contents) contents, err = jade.Parse(name, contents)
} }
if err != nil {
return err
}
// Add our funcmaps. // Add our funcmaps.
if s.Config.HTMLTemplate.Funcs != nil { if s.Config.HTMLTemplate.Funcs != nil {