corrected json
extracted method to check if message should be logged