mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-07-06 21:37:47 +02:00
refactor: remove log from fileutil
This commit is contained in:
@@ -65,6 +65,7 @@ func Execute() {
|
|||||||
if err = fileutil.CompressDir(outputDir); err != nil {
|
if err = fileutil.CompressDir(outputDir); err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
log.Noticef("compress success")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"hack-browser-data/internal/log"
|
|
||||||
|
|
||||||
cp "github.com/otiai10/copy"
|
cp "github.com/otiai10/copy"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,7 +70,7 @@ func ParentBaseDir(p string) string {
|
|||||||
func CompressDir(dir string) error {
|
func CompressDir(dir string) error {
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := ioutil.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
return err
|
||||||
}
|
}
|
||||||
var b = new(bytes.Buffer)
|
var b = new(bytes.Buffer)
|
||||||
zw := zip.NewWriter(b)
|
zw := zip.NewWriter(b)
|
||||||
@@ -91,7 +89,7 @@ func CompressDir(dir string) error {
|
|||||||
}
|
}
|
||||||
err = os.Remove(fileName)
|
err = os.Remove(fileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := zw.Close(); err != nil {
|
if err := zw.Close(); err != nil {
|
||||||
@@ -106,6 +104,5 @@ func CompressDir(dir string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Noticef("compress success, zip filename is %s", filename)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user