Merge branch 'merge49final'
Этот коммит содержится в:
@@ -126,7 +126,14 @@ func New(options ...Option) (outApp *App, outErr error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.AppErrorInit(utils.T)
|
model.AppErrorInit(utils.T)
|
||||||
|
|
||||||
|
// The first time we load config, clear any existing filters to allow the configuration
|
||||||
|
// changes to take effect. This is safe only because no one else is logging at this point.
|
||||||
|
l4g.Close()
|
||||||
|
|
||||||
if err := app.LoadConfig(app.configFile); err != nil {
|
if err := app.LoadConfig(app.configFile); err != nil {
|
||||||
|
// Re-initialize the default logger as we bail out.
|
||||||
|
l4g.Global = l4g.NewDefaultLogger(l4g.DEBUG)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
app.EnableConfigWatch()
|
app.EnableConfigWatch()
|
||||||
|
|||||||
@@ -12,12 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (a *App) SessionHasPermissionTo(session model.Session, permission *model.Permission) bool {
|
func (a *App) SessionHasPermissionTo(session model.Session, permission *model.Permission) bool {
|
||||||
if !a.RolesGrantPermission(session.GetUserRoles(), permission.Id) {
|
return a.RolesGrantPermission(session.GetUserRoles(), permission.Id)
|
||||||
a.ClearSessionCacheForUser(session.UserId)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// DO NOT USE: LEGACY
|
/// DO NOT USE: LEGACY
|
||||||
|
|||||||
@@ -84,13 +84,15 @@ func ConfigureCmdLineLog() {
|
|||||||
ConfigureLog(&ls)
|
ConfigureLog(&ls)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConfigureLog enables and configures logging.
|
||||||
|
//
|
||||||
|
// Note that it is not currently possible to disable filters nor to modify previously enabled
|
||||||
|
// filters, given the lack of concurrency guarantees from the underlying l4g library.
|
||||||
|
//
|
||||||
// TODO: this code initializes console and file logging. It will eventually be replaced by JSON logging in logger/logger.go
|
// TODO: this code initializes console and file logging. It will eventually be replaced by JSON logging in logger/logger.go
|
||||||
// See PLT-3893 for more information
|
// See PLT-3893 for more information
|
||||||
func ConfigureLog(s *model.LogSettings) {
|
func ConfigureLog(s *model.LogSettings) {
|
||||||
|
if _, alreadySet := l4g.Global["stdout"]; !alreadySet && s.EnableConsole {
|
||||||
l4g.Close()
|
|
||||||
|
|
||||||
if s.EnableConsole {
|
|
||||||
level := l4g.DEBUG
|
level := l4g.DEBUG
|
||||||
if s.ConsoleLevel == "INFO" {
|
if s.ConsoleLevel == "INFO" {
|
||||||
level = l4g.INFO
|
level = l4g.INFO
|
||||||
@@ -105,8 +107,7 @@ func ConfigureLog(s *model.LogSettings) {
|
|||||||
l4g.AddFilter("stdout", level, lw)
|
l4g.AddFilter("stdout", level, lw)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.EnableFile {
|
if _, alreadySet := l4g.Global["file"]; !alreadySet && s.EnableFile {
|
||||||
|
|
||||||
var fileFormat = s.FileFormat
|
var fileFormat = s.FileFormat
|
||||||
|
|
||||||
if fileFormat == "" {
|
if fileFormat == "" {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user