| 123456789101112131415161718192021222324252627282930313233343536373839 | 
							- package logging
 
- import (
 
- 	"fmt"
 
- 	"time"
 
- )
 
- func getLogFilePath(rootPath, savePath string) string {
 
- 	return fmt.Sprintf("%s%s", rootPath, savePath)
 
- }
 
- func getLogFileName(saveName, timeFormat, logFileExt string) string {
 
- 	return fmt.Sprintf("%s%s.%s", saveName, time.Now().Format(timeFormat), logFileExt)
 
- }
 
- //func openLogFile(fileName, filePath string) (*os.File, error) {
 
- //	dir, err := os.Getwd()
 
- //	if err != nil {
 
- //		return nil, fmt.Errorf("os.Getwd err: %v", err)
 
- //	}
 
- //
 
- //	src := dir + "/" + filePath
 
- //	perm := file.CheckPermission(src)
 
- //	if perm == true {
 
- //		return nil, fmt.Errorf("file.CheckPermission Permission denied src: %s", src)
 
- //	}
 
- //
 
- //	err = file.IsNotExistMkDir(src)
 
- //	if err != nil {
 
- //		return nil, fmt.Errorf("file.IsNotExistMkDir src: %s, err: %v", src, err)
 
- //	}
 
- //
 
- //	f, err := file.Open(src+fileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
 
- //	if err != nil {
 
- //		return nil, fmt.Errorf("Fail to OpenFile :%v", err)
 
- //	}
 
- //
 
- //	return f, nil
 
- //}
 
 
  |