Allow making logging toggleable.

Signed-off-by: TheSniperFan <thesniperfan@gmail.com>
Refactoring, documentation & cleanup.

Signed-off-by: TheSniperFan <thesniperfan@gmail.com>