Last active
August 6, 2019 12:18
-
-
Save edengal/542c8fd3bbebc02d4d745c7469140dc4 to your computer and use it in GitHub Desktop.
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
@TimberLog(name = "main_application") | |
public static void main(String[] args) { | |
TimberLogger.logContext("userId", userId); | |
isUserAuthorized(userId); | |
String sql = getSqlQuery(args); | |
List<String> result = runSql(sql); | |
} | |
@TimberLog(name = "is_user_authorized") | |
private static void isUserAuthorized(String userId){ | |
boolean isAuthorized = ... | |
TimberLogger.logString("isAuthorized", isAuthorized); | |
} | |
@TimberLog(name = "get_sql_query") | |
private static String getSqlQuery(String[] args) { | |
String sql = createSqlQueryFromArgs(args); | |
TimberLogger.logText("sql", sql); | |
validateSql(sql); | |
return sql; | |
} | |
@TimberLog(name = "create_sql_query_from_args") | |
private static String createSqlQueryFromArgs(String[] args) { | |
... | |
} | |
@TimberLog(name = "validate_sql") | |
private static void validateSql(String sql) { | |
... | |
} | |
@TimberLog(name = "run_sql") | |
private static List<String> runSql(String sql){ | |
List<String> result = ... | |
TimberLogger.logMetric("resultSize", result.size()); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment