Created
August 27, 2014 03:02
-
-
Save creativepsyco/3c08030fe3b31b4c7961 to your computer and use it in GitHub Desktop.
useful gist to clean up tokens from the log string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String stripTokens(String log) { | |
if (HIDE_TOKENS) { | |
/* Common REGEX patterns for replacing tokens */ | |
log = log.replaceAll("token=\\S*", "token=ACCESS_TOKEN_REMOVED "); | |
log = log.replaceAll("client_secret=\\S*", "client_secret=CLIENT_SECRET_REMOVED "); | |
log = log.replaceAll("access_token=\\S*", "access_token=ACCESS_TOKEN_REMOVED "); | |
log = log.replaceAll("code=\\S*", "code=SOME_CODE_REMOVED "); | |
} | |
return log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment