Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpeedLimitManager.LoadData log spamming in DEBUG builds #735

Closed
originalfoo opened this issue Feb 24, 2020 · 1 comment · Fixed by #736
Closed

SpeedLimitManager.LoadData log spamming in DEBUG builds #735

originalfoo opened this issue Feb 24, 2020 · 1 comment · Fixed by #736
Labels
code cleanup Refactor code, remove old code, improve maintainability low priority Issue with low priority of work technical Tasks that need to be performed in order to improve quality and maintainability
Milestone

Comments

@originalfoo
Copy link
Member

In DEBUG builds, log is being spammed with this sort of stuff:

Debug 69.7551933: SpeedLimitManager.LoadData: Loading lane speed limit: lane 37910 = 31 km/h
Debug 69.7557976: SpeedLimitManager.LoadData: Loading lane speed limit: lane 158388 = 31 km/h
Debug 69.7563927: SpeedLimitManager.LoadData: Loading lane speed limit: lane 127264 = 62 km/h
Debug 69.7569444: SpeedLimitManager.LoadData: Loading lane speed limit: lane 15057 = 62 km/h
Debug 69.7574998: SpeedLimitManager.LoadData: Loading lane speed limit: lane 124894 = 78 km/h
Debug 69.7580781: SpeedLimitManager.LoadData: Loading lane speed limit: lane 123485 = 78 km/h
Debug 69.7586568: SpeedLimitManager.LoadData: Loading lane speed limit: lane 187456 = 94 km/h
.....etc.....

It should either be removed or encapsulated in logging switch such as DebugSwitch.SpeedLimits (flag 26).

@originalfoo originalfoo added low priority Issue with low priority of work technical Tasks that need to be performed in order to improve quality and maintainability code cleanup Refactor code, remove old code, improve maintainability labels Feb 24, 2020
@originalfoo
Copy link
Member Author

Hrm, something weird here...

                    if (IsValidRange(customSpeedLimit)) {
                        // lane speed limit differs from default speed limit
#if DEBUGLOAD
                        Log._DebugIf(DebugSwitch.SpeedLimits.Get(), () =>
                            "SpeedLimitManager.LoadData: Loading lane speed limit: lane " +
                            $"{laneSpeedLimit.laneId} = {laneSpeedLimit.speedLimit}");
#endif
                        Flags.SetLaneSpeedLimit(laneSpeedLimit.laneId, laneSpeedLimit.speedLimit);

                        Log._DebugIf(DebugSwitch.SpeedLimits.Get(), () =>
                            "SpeedLimitManager.LoadData: Loading lane speed limit: " +
                            $"lane {laneSpeedLimit.laneId} = {laneSpeedLimit.speedLimit} km/h");

                        float kmph = laneSpeedLimit.speedLimit /
                                     Constants.SPEED_TO_KMPH; // convert to game units

                        Flags.SetLaneSpeedLimit(laneSpeedLimit.laneId, kmph);
                    } else {

Why are we Flags.SetLaneSpeedLimit() twice?

Will send PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Refactor code, remove old code, improve maintainability low priority Issue with low priority of work technical Tasks that need to be performed in order to improve quality and maintainability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant