etternagame / etterna

Advanced cross-platform rhythm game focused on keyboard play
https://etternaonline.com/
MIT License
474 stars 132 forks source link

Consolidate consecutive duplicate logger lines #1304

Closed StarbotArc closed 2 weeks ago

StarbotArc commented 2 months ago

Basically, no more big file sizes from repetitive logs. This pull request exists for issue #1291.

nico-abram commented 2 months ago

Why is last_msg a pointer? Can't we use a std::string directly and use an empty string instead of null?

StarbotArc commented 2 months ago

Sorry, I don't have crazy on-hand experience with C++, I actually write more C code, so I resorted more to pointers instead. If you think that's a better idea, I would say go for it.

nico-abram commented 2 months ago

LGTM

Only nits like I mentioned on discord are

(1) maybe we can unlock the mutex before the call to plog by making a string copy (2) I think we can remove the if (this->last_msg.size() > 0) condition, the initial empty string should work fine on the if (message == this->last_msg) check Actually I think this would add an empty string to the log on each program startup, so ignore it

poco0317 commented 2 weeks ago

superceded by #1305