Add configurable debug logging #22

Merged
Dniel97 merged 2 commits from Bottersnike/segatools:develop into develop 2024-07-01 18:42:02 +00:00
Contributor

Rather than a bunch of #if 0 statements, switch debug logging to use compile time definitions. These are controlled by meson options.

For development convenience, support for an ignored file MesonLocalOptions.mk is added, to ensure debug flags aren't accidentally committed. For example, mine currently contains

MESON_OPTIONS += -Dlog_chuni_slider=true
MESON_OPTIONS += -Dlog_chusan_slider=true

Additionally, for the truly insane, log_all is present to enable all logging. This is insanity and I do not know why you would want to do this. I hope you have a large scrollback.

Rather than a bunch of `#if 0` statements, switch debug logging to use compile time definitions. These are controlled by meson options. For development convenience, support for an ignored file `MesonLocalOptions.mk` is added, to ensure debug flags aren't accidentally committed. For example, mine currently contains ```make MESON_OPTIONS += -Dlog_chuni_slider=true MESON_OPTIONS += -Dlog_chusan_slider=true ``` Additionally, for the truly insane, `log_all` is present to enable all logging. This is insanity and I do not know why you would want to do this. I hope you have a large scrollback.
Bottersnike added 1 commit 2024-06-20 00:24:36 +00:00
Dniel97 requested changes 2024-06-23 10:23:41 +00:00
Makefile Outdated
@ -14,0 +14,4 @@
# Add "-D[option]=[value]" here as necessary
MESON_OPTIONS :=
# For options that shouldn't be committed
include MesonLocalOptions.mk
Owner

What will happen if the file doesn't exist, as it is not commited by now? I would prefer to commit an empty MesonLocalOptions.mk file.

What will happen if the file doesn't exist, as it is not commited by now? I would prefer to commit an empty `MesonLocalOptions.mk` file.
Author
Contributor

I'll double check what happens, and if it would error I'll add a guard. committing an empty file defeats the point, as now it's easy to accidentally commit the debug options

I'll double check what happens, and if it would error I'll add a guard. committing an empty file defeats the point, as now it's easy to accidentally commit the debug options
Bottersnike marked this conversation as resolved
meson.options Outdated
@ -0,0 +1,65 @@
option('log_all',
Owner

For versions of meson before 1.1, this file was called meson_options.txt. So with the docker build script which is mainly used (I know should be changed) this won't work.

For versions of meson before 1.1, this file was called `meson_options.txt`. So with the docker build script which is mainly used (I know should be changed) this won't work.
Author
Contributor

Oh lmao I didn't realise the docker build was using an old af version of meson. Will amend.

Oh lmao I didn't realise the docker build was using an old af version of meson. Will amend.
Owner

Yeah it's using fedora 36 and meson Version: 0.62.2. Maybe just create the file twice lmao.

Yeah it's using fedora 36 and meson Version: 0.62.2. Maybe just create the file twice lmao.
Author
Contributor

Newer versions have full support for meson_options.txt so it's just a rename job :)

Newer versions have full support for meson_options.txt so it's just a rename job :)
Bottersnike marked this conversation as resolved
Bottersnike added 1 commit 2024-07-01 18:28:33 +00:00
Author
Contributor

All reviews resolved

All reviews resolved
Dniel97 merged commit ccb655a12b into develop 2024-07-01 18:42:02 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Dniel97/segatools#22
No description provided.