mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-03-13 02:33:47 +00:00
Enable verbose logging in signal-cli if log level is debug
If the log level is `debug` (either with the `LOG_LEVEL` environment variable or configuration option), enable verbose logging in `signal-cli`.
This commit is contained in:
parent
af34a0881c
commit
63b3160567
@ -89,6 +89,10 @@ func (s *CliClient) Execute(wait bool, args []string, stdin string) (string, err
|
||||
args = append([]string{"--trust-new-identities", trustModeStr}, args...)
|
||||
}
|
||||
|
||||
if log.GetLevel() >= log.DebugLevel {
|
||||
args = append([]string{"--verbose"}, args...)
|
||||
}
|
||||
|
||||
fullCmd := ""
|
||||
if stdin != "" {
|
||||
fullCmd += "echo '" + stdin + "' | "
|
||||
|
||||
@ -14,7 +14,7 @@ import (
|
||||
const supervisorctlConfigTemplate = `
|
||||
[program:%s]
|
||||
process_name=%s
|
||||
command=signal-cli --output=json --config %s%s daemon %s%s --tcp 127.0.0.1:%d
|
||||
command=signal-cli%s --output=json --config %s%s daemon %s%s --tcp 127.0.0.1:%d
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=10
|
||||
@ -78,6 +78,11 @@ func main() {
|
||||
log.Fatal("Couldn't create log folder ", supervisorctlLogFolder, ": ", err.Error())
|
||||
}
|
||||
|
||||
verbose := ""
|
||||
if utils.GetEnv("LOG_LEVEL", "") == "debug" {
|
||||
verbose = " --verbose"
|
||||
}
|
||||
|
||||
trustNewIdentities := ""
|
||||
trustNewIdentitiesEnv := utils.GetEnv("JSON_RPC_TRUST_NEW_IDENTITIES", "")
|
||||
if trustNewIdentitiesEnv == "on-first-use" {
|
||||
@ -96,7 +101,7 @@ func main() {
|
||||
supervisorctlConfigFilename := "/etc/supervisor/conf.d/" + "signal-cli-json-rpc-1.conf"
|
||||
|
||||
supervisorctlConfig := fmt.Sprintf(supervisorctlConfigTemplate, supervisorctlProgramName, supervisorctlProgramName,
|
||||
signalCliConfigDir, trustNewIdentities, signalCliIgnoreAttachments, signalCliIgnoreStories, tcpPort,
|
||||
verbose, signalCliConfigDir, trustNewIdentities, signalCliIgnoreAttachments, signalCliIgnoreStories, tcpPort,
|
||||
supervisorctlProgramName, supervisorctlProgramName)
|
||||
|
||||
err = ioutil.WriteFile(supervisorctlConfigFilename, []byte(supervisorctlConfig), 0644)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user