|
|
@@ -26,10 +26,10 @@ type StorageSize float64
|
|
|
|
|
|
// String implements the stringer interface.
|
|
|
func (s StorageSize) String() string {
|
|
|
- if s > 1000000 {
|
|
|
- return fmt.Sprintf("%.2f mB", s/1000000)
|
|
|
- } else if s > 1000 {
|
|
|
- return fmt.Sprintf("%.2f kB", s/1000)
|
|
|
+ if s > 1048576 {
|
|
|
+ return fmt.Sprintf("%.2f MiB", s/1048576)
|
|
|
+ } else if s > 1024 {
|
|
|
+ return fmt.Sprintf("%.2f KiB", s/1024)
|
|
|
} else {
|
|
|
return fmt.Sprintf("%.2f B", s)
|
|
|
}
|
|
|
@@ -38,10 +38,10 @@ func (s StorageSize) String() string {
|
|
|
// TerminalString implements log.TerminalStringer, formatting a string for console
|
|
|
// output during logging.
|
|
|
func (s StorageSize) TerminalString() string {
|
|
|
- if s > 1000000 {
|
|
|
- return fmt.Sprintf("%.2fmB", s/1000000)
|
|
|
- } else if s > 1000 {
|
|
|
- return fmt.Sprintf("%.2fkB", s/1000)
|
|
|
+ if s > 1048576 {
|
|
|
+ return fmt.Sprintf("%.2fMiB", s/1048576)
|
|
|
+ } else if s > 1024 {
|
|
|
+ return fmt.Sprintf("%.2fKiB", s/1024)
|
|
|
} else {
|
|
|
return fmt.Sprintf("%.2fB", s)
|
|
|
}
|