Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into files-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszo committed Jan 14, 2025
2 parents 04a006b + 6c6ec4d commit 3de66d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

*

## v5.3.2 (2024-12-23)

* Fix exit status on logs when it's a client timeout.

## v5.3.1 (2024-11-27)

* Fix release.
Expand Down
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -e
case $(uname -sm) in
"Darwin x86_64") target="darwin_amd64" ;;
"Darwin arm64") target="darwin_arm64" ;;
"Linux aarch64") target="linux_arm64" ;;
*) target="linux_amd64" ;;
esac

Expand Down
19 changes: 10 additions & 9 deletions pkg/koyeb/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (query *WatchLogsQuery) Execute() (chan WatchLogsEntry, error) {
// Stop sending ping messages to the websocket connection
conn.Stop()

logs <- WatchLogsEntry{Err: &errors.CLIError{
newErr := &errors.CLIError{
Icon: "⏰",
What: "Disconnected from the logs API",
Why: fmt.Sprintf("forced disconnection after %s", logsTimeout),
Expand All @@ -216,7 +216,8 @@ func (query *WatchLogsQuery) Execute() (chan WatchLogsEntry, error) {
},
Orig: nil,
Solution: "Run the command again to reconnect",
}}
}
log.Errorf("%s", newErr)
close(logs)
case msg := <-readCh:
// Sometimes, for example when passing a future date in --since, the
Expand Down Expand Up @@ -326,23 +327,23 @@ func (query *WatchLogsQuery) PrintAll() error {
if err != nil {
return err
}
for log := range logs {
if log.Err != nil {
return log.Err
for logl := range logs {
if logl.Err != nil {
return logl.Err
}
layout := "2006-01-02 15:04:05"
date := log.Date.Format(layout)
zone, _ := log.Date.Zone()
date := logl.Date.Format(layout)
zone, _ := logl.Date.Zone()

switch outputFormat {
case "json", "yaml":
data, err := json.Marshal(log)
data, err := json.Marshal(logl)
if err != nil {
return err
}
fmt.Printf("%s\n", data)
default:
fmt.Printf("[%s %s] %s %6s - %s\n", date, zone, renderer.FormatID(log.Labels.InstanceID, query.full), log.Stream, log.Msg)
fmt.Printf("[%s %s] %s %6s - %s\n", date, zone, renderer.FormatID(logl.Labels.InstanceID, query.full), logl.Stream, logl.Msg)
}
}
return nil
Expand Down

0 comments on commit 3de66d1

Please sign in to comment.