fix logs
This commit is contained in:
@@ -83,7 +83,7 @@ func (t *TClient) Channel(ctx context.Context, channel *tg.Channel, cfg *DBChann
|
||||
zap.Int64("size", doc.GetSize()),
|
||||
zap.String("SizeHuman", humanize.Bytes(uint64(doc.GetSize()))),
|
||||
)
|
||||
continue
|
||||
break
|
||||
}
|
||||
|
||||
data, err := t.saveDocument(ctx, cfg, doc)
|
||||
|
||||
@@ -2,7 +2,7 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"exporter/config"
|
||||
|
||||
@@ -22,8 +22,8 @@ func ExportCmd() *cobra.Command {
|
||||
Use: "export",
|
||||
Short: "export channels",
|
||||
PreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println("init client")
|
||||
defer fmt.Println("init client done")
|
||||
log.Println("init client")
|
||||
defer log.Println("init client done")
|
||||
return InitClient(config.C)
|
||||
},
|
||||
RunE: wrapE(exportCmd),
|
||||
|
||||
@@ -2,7 +2,7 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"exporter/config"
|
||||
|
||||
@@ -14,8 +14,8 @@ func LoginCmd() *cobra.Command {
|
||||
Use: "login",
|
||||
Short: "login account",
|
||||
PreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println("init client")
|
||||
defer fmt.Println("init client done")
|
||||
log.Println("init client")
|
||||
defer log.Println("init client done")
|
||||
return InitClient(config.C)
|
||||
},
|
||||
RunE: wrapE(func(ctx context.Context) error {
|
||||
|
||||
@@ -2,7 +2,7 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"exporter/config"
|
||||
@@ -20,8 +20,8 @@ func WatchCmd() *cobra.Command {
|
||||
Use: "watch",
|
||||
Short: "watch channels",
|
||||
PreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println("init client")
|
||||
defer fmt.Println("init client done")
|
||||
log.Println("init client")
|
||||
defer log.Println("init client done")
|
||||
return InitClient(config.C)
|
||||
},
|
||||
RunE: wrapE(watchCmd),
|
||||
|
||||
@@ -2,6 +2,7 @@ package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"exporter/config"
|
||||
|
||||
@@ -49,6 +50,8 @@ func getClient() *TClient {
|
||||
|
||||
func wrapE(f func(context.Context) error) func(cmd *cobra.Command, args []string) error {
|
||||
return func(cmd *cobra.Command, args []string) error {
|
||||
log.Println("run client")
|
||||
defer log.Println("run client done")
|
||||
return getClient().Client.Run(context.Background(), f)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user