Skip to content

Commit

Permalink
fix: use IEC standard for file sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
l3uddz committed Jul 12, 2020
1 parent 5651cb6 commit 637dce0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion uploader/checker/age.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (Age) Check(cfg *config.UploaderCheck, log *logrus.Entry, paths []pathutils
if checkPassed {
log.WithFields(logrus.Fields{
"files_passed": filesPassed,
"files_size": humanize.Bytes(uint64(filesSize)),
"files_size": humanize.IBytes(uint64(filesSize)),
}).Info("Local files matching check criteria")
}

Expand Down
8 changes: 4 additions & 4 deletions uploader/checker/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ type Size struct{}
func (Size) Check(cfg *config.UploaderCheck, log *logrus.Entry, paths []pathutils.Path, size uint64) (*Result, error) {
// Check Total Size
if size > cfg.Limit {
s := humanize.Bytes(size)
s := humanize.IBytes(size)
log.WithFields(logrus.Fields{
"max_size": humanize.Bytes(cfg.Limit),
"max_size": humanize.IBytes(cfg.Limit),
"current_size": s,
"over_size": humanize.Bytes(size - cfg.Limit),
"over_size": humanize.IBytes(size - cfg.Limit),
}).Info("Size is greater than specified limit")

return &Result{
Expand All @@ -28,7 +28,7 @@ func (Size) Check(cfg *config.UploaderCheck, log *logrus.Entry, paths []pathutil

return &Result{
Passed: false,
Info: humanize.Bytes(cfg.Limit - size),
Info: humanize.IBytes(cfg.Limit - size),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion uploader/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (u *Uploader) RefreshLocalFiles() error {
// log results
u.Log.WithFields(logrus.Fields{
"found_files": len(u.LocalFiles),
"files_size": humanize.Bytes(u.LocalFilesSize),
"files_size": humanize.IBytes(u.LocalFilesSize),
"local_folder": u.Config.LocalFolder,
}).Info("Refreshed local files")

Expand Down

0 comments on commit 637dce0

Please sign in to comment.