use json logging when in subordinate mode (#789)

This commit is contained in:
Michael Quigley 2024-11-13 11:38:57 -05:00
parent 85a22950a7
commit 6b4dbaafb0
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
4 changed files with 18 additions and 0 deletions

View File

@ -77,6 +77,10 @@ func newAccessPrivateCommand() *accessPrivateCommand {
}
func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) {
if cmd.subordinate {
logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: time.RFC3339Nano})
}
root, err := environment.LoadRoot()
if err != nil {
cmd.error(err)

View File

@ -26,6 +26,7 @@ import (
"os/signal"
"path/filepath"
"syscall"
"time"
)
func init() {
@ -70,6 +71,10 @@ func newSharePrivateCommand() *sharePrivateCommand {
}
func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
if cmd.subordinate {
logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: time.RFC3339Nano})
}
root, err := environment.LoadRoot()
if err != nil {
cmd.error("error loading environment", err)

View File

@ -85,6 +85,10 @@ func newSharePublicCommand() *sharePublicCommand {
}
func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) {
if cmd.subordinate {
logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: time.RFC3339Nano})
}
root, err := environment.LoadRoot()
if err != nil {
cmd.error("error loading environment", err)

View File

@ -25,6 +25,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"time"
)
func init() {
@ -65,6 +66,10 @@ func newShareReservedCommand() *shareReservedCommand {
}
func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) {
if cmd.subordinate {
logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: time.RFC3339Nano})
}
root, err := environment.LoadRoot()
if err != nil {
cmd.error("error loading environment", err)