Skip to content

Commit

Permalink
Suppress size output if --quiet is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jan 21, 2025
1 parent 275638c commit afff8db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions commands/service_compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
})
}
var verbosity logger.Verbosity = logger.VerbosityNormal
if req.GetQuiet() {
verbosity = logger.VerbosityQuiet
}
if req.GetVerbose() {
verbosity = logger.VerbosityVerbose
}
Expand Down
28 changes: 15 additions & 13 deletions internal/arduino/builder/sizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,21 @@ func (b *Builder) checkSize() (ExecutablesFileSections, error) {
return nil, nil
}

b.logger.Info(i18n.Tr("Sketch uses %[1]s bytes (%[3]s%%) of program storage space. Maximum is %[2]s bytes.",
strconv.Itoa(textSize),
strconv.Itoa(maxTextSize),
strconv.Itoa(textSize*100/maxTextSize)))
if dataSize >= 0 {
if maxDataSize > 0 {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes (%[3]s%%) of dynamic memory, leaving %[4]s bytes for local variables. Maximum is %[2]s bytes.",
strconv.Itoa(dataSize),
strconv.Itoa(maxDataSize),
strconv.Itoa(dataSize*100/maxDataSize),
strconv.Itoa(maxDataSize-dataSize)))
} else {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes of dynamic memory.", strconv.Itoa(dataSize)))
if b.logger.VerbosityLevel() > logger.VerbosityQuiet {
b.logger.Info(i18n.Tr("Sketch uses %[1]s bytes (%[3]s%%) of program storage space. Maximum is %[2]s bytes.",
strconv.Itoa(textSize),
strconv.Itoa(maxTextSize),
strconv.Itoa(textSize*100/maxTextSize)))
if dataSize >= 0 {
if maxDataSize > 0 {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes (%[3]s%%) of dynamic memory, leaving %[4]s bytes for local variables. Maximum is %[2]s bytes.",
strconv.Itoa(dataSize),
strconv.Itoa(maxDataSize),
strconv.Itoa(dataSize*100/maxDataSize),
strconv.Itoa(maxDataSize-dataSize)))
} else {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes of dynamic memory.", strconv.Itoa(dataSize)))
}
}
}

Expand Down

0 comments on commit afff8db

Please sign in to comment.