Skip to content

Conversation

vadcx
Copy link

@vadcx vadcx commented Jan 9, 2024

This will greatly reduce the amount of jumping columns due to numbers pretty printing the fractional part and dropping ".000"

Ideally one would use i18n locale-aware format with Intl.NumberFormat, there it seems possible to match the width+precision parameters from printf in C.

I based the code on this example:

let arr = [0.0, 1.123, 5.1234, 6.1236, 10.123, 50.750, 60.1, 99.99, 100]
for (const num of arr) {
    process.stdout.write(`Number is: ${num?.toFixed(3)}\n`);
}

process.stdout.write(`Number is: ${undefined?.toFixed(3)}\n`);
Number is: 0.000
Number is: 1.123
Number is: 5.123
Number is: 6.124
Number is: 10.123
Number is: 50.750
Number is: 60.100
Number is: 99.990
Number is: 100.000
Number is: undefined

So if for example previously it looked like this:

[Legendary]:        Progress for Fall Guys: 69.89%/524.34MB/00:34:00 Down: 0MB/s / Disk: 0MB/s
[Legendary]:        Progress for Fall Guys: 69.91%/525.32MB/00:34:00 Down: 0.97MB/s / Disk: 1MB/s
[Legendary]:        Progress for Fall Guys: 69.91%/525.32MB/00:34:03 Down: 0MB/s / Disk: 0MB/s
[Legendary]:        Progress for Fall Guys: 69.92%/526.28MB/00:34:04 Down: 0.96MB/s / Disk: 1MB/s

With the fixed precision:

[Legendary]:        Progress for Fall Guys: 69.89%/524.34MB/00:34:00 Down: 0.00MB/s / Disk: 0.0MB/s
[Legendary]:        Progress for Fall Guys: 69.91%/525.32MB/00:34:00 Down: 0.97MB/s / Disk: 1.0MB/s
[Legendary]:        Progress for Fall Guys: 69.91%/525.32MB/00:34:03 Down: 0.00MB/s / Disk: 0.0MB/s
[Legendary]:        Progress for Fall Guys: 69.92%/526.28MB/00:34:04 Down: 0.96MB/s / Disk: 1.0MB/s

If the integer part jumps from 9 to 10, it'll still get wider but it's still an improvement. I did not format progress.bytes because it's never parsed into integer/float above.

Finally there's a fair amount of duplicated code between gog/epic/nile games.ts. Someone with an idea of TS might want to take a look at.


Nothing tested, I don't have a working dev install either. This is only a proposal.

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

This will greatly reduce the amount of jumping columns due to numbers
pretty printing the fractional part and dropping ".000"

Ideally one would use i18n locale-aware format with Intl.NumberFormat,
there it seems possible to match the width+precision parameters from
printf in C.
@flavioislima
Copy link
Member

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@arielj
Copy link
Collaborator

arielj commented Jan 11, 2024

If the integer part jumps from 9 to 10, it'll still get wider but it's still an improvement. I did not format progress.bytes because it's never parsed into integer/float above.

maybe we can pad left with a white space if less than 10, that way we can cover up to 99.99MB/s which I think is enough and should be simple to do

@CommandMC
Copy link
Collaborator

Closing primarily due to inactivity

I do see where this is coming from, but I don't think we need this. Logs aren't intended to be read by an end user, they don't have to be that pretty

@CommandMC CommandMC closed this Oct 18, 2025
@Heroic-Games-Launcher Heroic-Games-Launcher locked and limited conversation to collaborators Oct 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants