mirror of
https://github.com/kataras/iris.git
synced 2026-01-23 03:45:56 +00:00
Nothing special: when iris.DevLogger() used then group logs based on time.
Former-commit-id: 921e2d5baabd3d299f4a719ef0a0abd924bc3bc9
This commit is contained in:
@@ -55,10 +55,11 @@ func New() iris.Policies {
|
||||
|
||||
var logger func(iris.LogMode, string)
|
||||
return iris.Policies{
|
||||
EventPolicy: iris.EventPolicy{Boot: func(s *iris.Framework) {
|
||||
logger = s.Log
|
||||
s.Set(iris.OptionOther(iris.RouterNameConfigKey, Name))
|
||||
}},
|
||||
EventPolicy: iris.EventPolicy{
|
||||
Boot: func(s *iris.Framework) {
|
||||
logger = s.Log
|
||||
s.Set(iris.OptionOther(iris.RouterNameConfigKey, Name))
|
||||
}},
|
||||
RouterReversionPolicy: iris.RouterReversionPolicy{
|
||||
// path normalization done on iris' side
|
||||
StaticPath: staticPath,
|
||||
|
||||
@@ -518,8 +518,7 @@ func New() iris.Policies {
|
||||
Boot: func(s *iris.Framework) {
|
||||
logger = s.Log
|
||||
s.Set(iris.OptionOther(iris.RouterNameConfigKey, Name))
|
||||
},
|
||||
},
|
||||
}},
|
||||
RouterReversionPolicy: iris.RouterReversionPolicy{
|
||||
// path normalization done on iris' side
|
||||
StaticPath: func(path string) string {
|
||||
|
||||
@@ -76,6 +76,7 @@ func (s *sessions) Adapt(frame *iris.Policies) {
|
||||
}
|
||||
|
||||
policy.Adapt(frame)
|
||||
|
||||
}
|
||||
|
||||
// UseDatabase adds a session database to the manager's provider,
|
||||
|
||||
@@ -6,6 +6,11 @@ import (
|
||||
"gopkg.in/kataras/iris.v6/adaptors/typescript"
|
||||
)
|
||||
|
||||
// NOTE: Some machines don't allow to install typescript automatically, so if you don't have typescript installed
|
||||
// and the typescript adaptor doesn't works for you then follow the below steps:
|
||||
// 1. close the iris server
|
||||
// 2. open your terminal and execute: npm install -g typescript
|
||||
// 3. start your iris server, it should be work, as expected, now.
|
||||
func main() {
|
||||
app := iris.New()
|
||||
app.Adapt(iris.DevLogger())
|
||||
|
||||
@@ -172,12 +172,13 @@ func (e *Editor) start() {
|
||||
|
||||
cmd := npm.CommandBuilder("node", npm.NodeModuleAbs("alm/src/server.js"))
|
||||
cmd.AppendArguments("-a", e.config.Username+":"+e.config.Password,
|
||||
"-h", e.config.Hostname, "-t", strconv.Itoa(e.config.Port), "-d", e.config.WorkingDir[0:len(e.config.WorkingDir)-1])
|
||||
"-h", e.config.Hostname, "-t", strconv.Itoa(e.config.Port), "-d", e.config.WorkingDir)
|
||||
// for auto-start in the browser: cmd.AppendArguments("-o")
|
||||
if e.config.KeyFile != "" && e.config.CertFile != "" {
|
||||
cmd.AppendArguments("--httpskey", e.config.KeyFile, "--httpscert", e.config.CertFile)
|
||||
}
|
||||
|
||||
prefix := ""
|
||||
// when debug is not disabled
|
||||
// show any messages to the user( they are useful here)
|
||||
// to the io.Writer that iris' user is defined from configuration
|
||||
@@ -189,7 +190,7 @@ func (e *Editor) start() {
|
||||
|
||||
go func() {
|
||||
for outputScanner.Scan() {
|
||||
e.logger(iris.DevMode, "Editor: "+outputScanner.Text())
|
||||
e.logger(iris.DevMode, prefix+outputScanner.Text())
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -198,7 +199,7 @@ func (e *Editor) start() {
|
||||
errScanner := bufio.NewScanner(errReader)
|
||||
go func() {
|
||||
for errScanner.Scan() {
|
||||
e.logger(iris.DevMode, "Editor: "+errScanner.Text())
|
||||
e.logger(iris.DevMode, prefix+errScanner.Text())
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -207,7 +208,7 @@ func (e *Editor) start() {
|
||||
|
||||
err := cmd.Start()
|
||||
if err != nil {
|
||||
e.logger(iris.ProdMode, "Error while running alm-tools. Trace: "+err.Error())
|
||||
e.logger(iris.ProdMode, prefix+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -104,15 +104,15 @@ func (t *TsAdaptor) start() {
|
||||
}
|
||||
|
||||
}
|
||||
t.logger(iris.DevMode, fmt.Sprintf("%d Typescript project(s) compiled ( %d monitored by a background file watcher ) ", len(projects), watchedProjects))
|
||||
// t.logger(iris.DevMode, fmt.Sprintf("%d Typescript project(s) compiled ( %d monitored by a background file watcher ) ", len(projects), watchedProjects))
|
||||
} else {
|
||||
//search for standalone typescript (.ts) files and compile them
|
||||
files := t.getTypescriptFiles()
|
||||
if len(files) > 0 {
|
||||
watchedFiles := 0
|
||||
/* watchedFiles := 0
|
||||
if t.Config.Tsconfig.CompilerOptions.Watch {
|
||||
watchedFiles = len(files)
|
||||
}
|
||||
}*/
|
||||
//it must be always > 0 if we came here, because of if hasTypescriptFiles == true.
|
||||
for _, file := range files {
|
||||
absPath, err := filepath.Abs(file)
|
||||
@@ -142,7 +142,7 @@ func (t *TsAdaptor) start() {
|
||||
}()
|
||||
|
||||
}
|
||||
t.logger(iris.DevMode, fmt.Sprintf("%d Typescript file(s) compiled ( %d monitored by a background file watcher )", len(files), watchedFiles))
|
||||
// t.logger(iris.DevMode, fmt.Sprintf("%d Typescript file(s) compiled ( %d monitored by a background file watcher )", len(files), watchedFiles))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,12 @@ func (s *server) Adapt(frame *iris.Policies) {
|
||||
// serve the client side on domain:port/iris-ws.js
|
||||
f.StaticContent(wsClientSidePath, "application/javascript", ClientSource).ChangeName(clientSideLookupName)
|
||||
}
|
||||
|
||||
// If we want to show configuration fields... I'm not sure for this yet, so let it commented: f.Logf(iris.DevMode, "%#v", s.config)
|
||||
},
|
||||
|
||||
Build: func(f *iris.Framework) {
|
||||
f.Log(iris.DevMode, "Serving Websockets on "+f.Config.VHost+s.config.Endpoint)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user