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

Enabling remote logging on demand in release #305

Open
Donnit opened this issue Apr 22, 2021 · 0 comments
Open

Enabling remote logging on demand in release #305

Donnit opened this issue Apr 22, 2021 · 0 comments

Comments

@Donnit
Copy link

Donnit commented Apr 22, 2021

Hi! I just discovered this great pod, and I managed to make it working with success in Debug configuration.
I've found that macros like LoggerApp LoggerError etc. are defined within the preprocessor macro DEBUG, so they are available only for debug builds. I would like them to be available also on release builds, only when the user activate remote logging.

What would be the best practice to achieve this behaviour? What I would do:

  • set a boolean on the NSUserDefaults when user switch the remote logging (and configure the logger for remote connection)

  • on a my own header file, define new macros to check the boolean everytime before calling LogMessageF, for example:

#define MyLoggerError(level, ...) \ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"remotelogging"]) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Error", level, __VA_ARGS__)

I wonder if this check would slow down performance even if the boolean is set to NO. Using the DEBUG preprocessor LoggerError is replaced with while(0) {} and I don't think it costs any time in runtime.

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant