Skip to content

Commit

Permalink
Updating logging
Browse files Browse the repository at this point in the history
  • Loading branch information
madflojo committed Oct 23, 2023
1 parent b542bf2 commit 878ca02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions functions/src/init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ func (f *Function) Handler(_ []byte) ([]byte, error) {
// Fetch the airport data
data, err := f.tarmac.Function.Call("fetch", []byte(""))
if err != nil {
f.tarmac.Logger.Error(fmt.Sprintf("Failed to fetch airport data", err))
f.tarmac.Logger.Error(fmt.Sprintf("Failed to fetch airport data - %s", err))
return []byte(""), fmt.Errorf("Failed to fetch airport data: %s", err)
}

// Parse the data
parser, err := csv.New(bytes.NewReader(data))
if err != nil {
f.tarmac.Logger.Error(fmt.Sprintf("Failed to create CSV parser", err))
f.tarmac.Logger.Error(fmt.Sprintf("Failed to create CSV parser - %s", err))
return []byte(""), fmt.Errorf("Failed to create CSV parser: %s", err)
}

airports, err := parser.Parse()
if err != nil {
f.tarmac.Logger.Error(fmt.Sprintf("Failed to parse airport data", err))
f.tarmac.Logger.Error(fmt.Sprintf("Failed to parse airport data - %s", err))
return []byte(""), fmt.Errorf("Failed to parse airport data: %s", err)
}
f.tarmac.Logger.Info(fmt.Sprintf("Fetched %d airports", len(airports)))
Expand Down

0 comments on commit 878ca02

Please sign in to comment.