Skip to content

Improve code readability by simplifying debug logging #349

@dymanoid

Description

@dymanoid

In the current code, there are a lot of such constructs:

#if DEBUG
    if (debug)
        Log._Debug("Whatever");
#endif

They are sometimes repeated very often, after each line (e.g. JunctionRestrictionsManager.cs).
It's almost impossible to read and to understand code like that.

Suggested improvements:

  • The Log._Debug method already has the [Conditional("DEBUG")] attribute, so no need in #if DEBUG / #endif region at all
  • The if (debug) check can actually be transferred into the Log._Debug method

After those improvements, the logging code becomes as simple as that:

        Log._Debug("Whatever");

It will make the code much more readable and won't affect performance.

Metadata

Metadata

Assignees

Labels

adjustments requiredAn issue require some adjustments in codecode cleanupRefactor code, remove old code, improve maintainabilitytechnicalTasks that need to be performed in order to improve quality and maintainability

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions