Create a method to check if the value should be logged or not and reuse it on the logWithLevel(Object) method