Encapsulated log directory name into a struct
This commit is contained in:
parent
13c3de44be
commit
7996240b2e
8 changed files with 47 additions and 38 deletions
|
@ -38,8 +38,9 @@ func (pLog *PcpLogger) Log(logType int, level log.Level, logData log.Fields, mes
|
|||
func (plog *PcpLogger) SetLogFile(prefix string) {
|
||||
|
||||
pcpLogPrefix := strings.Join([]string{prefix, config.PCPConfig.FilenameExtension}, "")
|
||||
if logDir != "" {
|
||||
pcpLogPrefix = strings.Join([]string{logDir, pcpLogPrefix}, "/")
|
||||
dirName := logDir.getDirName()
|
||||
if dirName != "" {
|
||||
pcpLogPrefix = strings.Join([]string{dirName, pcpLogPrefix}, "/")
|
||||
}
|
||||
if logFile, err := os.Create(pcpLogPrefix); err != nil {
|
||||
log.Fatal("Unable to create logFile: ", err)
|
||||
|
|
Reference in a new issue