Skip to content

Commit

Permalink
ceph-extra-exporter: replace cybozu-go/log with log/slog
Browse files Browse the repository at this point in the history
Signed-off-by: Yuma Ogami <[email protected]>
  • Loading branch information
cupnes committed Nov 8, 2023
1 parent ad9bf42 commit b1a44f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions ceph-extra-exporter/executer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"sync"
"time"

"github.com/cybozu-go/log"
"github.com/prometheus/client_golang/prometheus"
)

Expand Down Expand Up @@ -141,7 +140,7 @@ func executeCommand(command []string, input io.Reader) ([]byte, error) {
go func() {
defer stdin.Close()
if _, err = io.Copy(stdin, input); err != nil {
_ = logger.Error("failed to io.Copy", map[string]interface{}{log.FnError: err})
_ = logger.Error("failed to io.Copy", map[string]interface{}{"error": err})
}
}()
}
Expand Down
10 changes: 6 additions & 4 deletions ceph-extra-exporter/log.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main

import "github.com/cybozu-go/log"
import (
"log/slog"
"os"
)

var logger *log.Logger
var logger *slog.Logger

func init() {
logger = log.NewLogger()
logger.SetFormatter(log.JSONFormat{})
logger = slog.New(slog.NewJSONHandler(os.Stderr, nil))
}

0 comments on commit b1a44f0

Please sign in to comment.