add ifdef macro to avoid warnings when not use logging mode