mirror of
https://github.com/F1bonacc1/process-compose.git
synced 2024-09-11 11:35:26 +03:00
Separate file for client
This commit is contained in:
parent
757937fbda
commit
6bc7fb3fec
@ -28,7 +28,9 @@ const (
|
||||
LogFileMode = os.FileMode(0600)
|
||||
)
|
||||
|
||||
var LogFilePath = filepath.Join(os.TempDir(), fmt.Sprintf("process-compose-%s.log", mustUser()))
|
||||
func GetLogFilePath() string {
|
||||
return filepath.Join(os.TempDir(), fmt.Sprintf("process-compose-%s%s.log", mustUser(), mode()))
|
||||
}
|
||||
|
||||
func procCompHome() string {
|
||||
if env := os.Getenv(pcConfigEnv); env != "" {
|
||||
@ -58,3 +60,17 @@ func mustUser() string {
|
||||
}
|
||||
return usr.Username
|
||||
}
|
||||
|
||||
func mode() string {
|
||||
if isClient() {
|
||||
return "-client"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func isClient() bool {
|
||||
if len(os.Args) > 1 {
|
||||
return os.Args[1] == "process"
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ func setupLogger(output io.Writer) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
file, err := os.OpenFile(config.LogFilePath, config.LogFileFlags, config.LogFileMode)
|
||||
file, err := os.OpenFile(config.GetLogFilePath(), config.LogFileFlags, config.LogFileMode)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user