mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-05-25 14:34:22 +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...)
|
args = append([]string{"--trust-new-identities", trustModeStr}, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if log.GetLevel() >= log.DebugLevel {
|
||||||
|
args = append([]string{"--verbose"}, args...)
|
||||||
|
}
|
||||||
|
|
||||||
fullCmd := ""
|
fullCmd := ""
|
||||||
if stdin != "" {
|
if stdin != "" {
|
||||||
fullCmd += "echo '" + stdin + "' | "
|
fullCmd += "echo '" + stdin + "' | "
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import (
|
|||||||
const supervisorctlConfigTemplate = `
|
const supervisorctlConfigTemplate = `
|
||||||
[program:%s]
|
[program:%s]
|
||||||
process_name=%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
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
startretries=10
|
startretries=10
|
||||||
@ -78,6 +78,11 @@ func main() {
|
|||||||
log.Fatal("Couldn't create log folder ", supervisorctlLogFolder, ": ", err.Error())
|
log.Fatal("Couldn't create log folder ", supervisorctlLogFolder, ": ", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verbose := ""
|
||||||
|
if utils.GetEnv("LOG_LEVEL", "") == "debug" {
|
||||||
|
verbose = " --verbose"
|
||||||
|
}
|
||||||
|
|
||||||
trustNewIdentities := ""
|
trustNewIdentities := ""
|
||||||
trustNewIdentitiesEnv := utils.GetEnv("JSON_RPC_TRUST_NEW_IDENTITIES", "")
|
trustNewIdentitiesEnv := utils.GetEnv("JSON_RPC_TRUST_NEW_IDENTITIES", "")
|
||||||
if trustNewIdentitiesEnv == "on-first-use" {
|
if trustNewIdentitiesEnv == "on-first-use" {
|
||||||
@ -96,7 +101,7 @@ func main() {
|
|||||||
supervisorctlConfigFilename := "/etc/supervisor/conf.d/" + "signal-cli-json-rpc-1.conf"
|
supervisorctlConfigFilename := "/etc/supervisor/conf.d/" + "signal-cli-json-rpc-1.conf"
|
||||||
|
|
||||||
supervisorctlConfig := fmt.Sprintf(supervisorctlConfigTemplate, supervisorctlProgramName, supervisorctlProgramName,
|
supervisorctlConfig := fmt.Sprintf(supervisorctlConfigTemplate, supervisorctlProgramName, supervisorctlProgramName,
|
||||||
signalCliConfigDir, trustNewIdentities, signalCliIgnoreAttachments, signalCliIgnoreStories, tcpPort,
|
verbose, signalCliConfigDir, trustNewIdentities, signalCliIgnoreAttachments, signalCliIgnoreStories, tcpPort,
|
||||||
supervisorctlProgramName, supervisorctlProgramName)
|
supervisorctlProgramName, supervisorctlProgramName)
|
||||||
|
|
||||||
err = ioutil.WriteFile(supervisorctlConfigFilename, []byte(supervisorctlConfig), 0644)
|
err = ioutil.WriteFile(supervisorctlConfigFilename, []byte(supervisorctlConfig), 0644)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user