Skip to content

Refactor internal logic and code duplication #17

@AndreLaranjeira

Description

@AndreLaranjeira

There is a lot of code that could be refactored into private function implementations and logical representations that could be improved for readability.

Task list:

  • Create a private function to encompass all 5 basic logging functions (they are the same aside from tag and context);
  • Create a function to lock or unlock the mutex if thread-safety is enabled (this is used a lot in the code);
  • Create boolean internal variables to replace checking if a pointer is null;
  • Refactor internal time format representation to utilize the struct created instead of a simple string;
  • Refactor color_background and color_text functions to use the enum representation of color. This should reduce the amount of cases in the switch;
  • Create function that receives a MessageCategory and returns msg_type text. Use this to avoid hardcoded msg_type strings;
  • Create set_time_format function that receives a TimeFormat pointer. Deprecate the other existing one;

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementSomething to be refactored or changed in the existing code

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions