Skip to content

Enabling remote logging on demand in release #305

Open
@Donnit

Description

@Donnit

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions