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

Extend the possibility to override AmplitudeLog logic #93

Closed
alok1111 opened this issue Jul 31, 2023 · 1 comment
Closed

Extend the possibility to override AmplitudeLog logic #93

alok1111 opened this issue Jul 31, 2023 · 1 comment

Comments

@alok1111
Copy link

Summary

I'd like Amplitude to use my system logger. Current AmplitudeLog and LogMode implementations don't allow me to reuse the logic from com.amplitude.AmplitudeLog#log method.
Sample implementation:

    private class AmplitudeLogWrapper extends AmplitudeLog {
        @Override
        public void log(String tag, String message, LogMode messageMode) {
            if (messageMode.level >= logMode.level) {
                if (messageMode.level >= LogMode.ERROR.level) {
                    log.error(tag + ": " + message);
                } else {
                    log.info(tag + ": " + message);
                }
            }
        }
    }

com.amplitude.AmplitudeLog#logMode and com.amplitude.AmplitudeLog.LogMode#level fields are inaccessible due to AmplitudeLog and LogMode implementations.
Please add corresponding getters as we can only use reflection to get the values.

Motivations

More friendly API that doesn't force you to use reflection.

@yuhao900914
Copy link
Contributor

Thanks for choosing amplitude. We appreciate your feedback.
The new version has the support to access logMode and logLevel. Please check it out.
Thanks.

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

2 participants