Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Logging] add FORCED_LOG_LEVEL #2723

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions octobot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ async def _get_authenticated_community_if_possible(config, logger):
constants.USER_ACCOUNT_EMAIL, None, auth_key=constants.USER_AUTH_KEY
)
except authentication.AuthenticationError as err:
logger.debug(f"Auth key auth failure ({err}). Trying other methods if available.")
logger.info(f"Auth key auth failure ({err}). Trying other methods if available.")
if constants.USER_ACCOUNT_EMAIL and constants.USER_PASSWORD_TOKEN:
try:
logger.debug("Attempting password token authentication")
await community_auth.login(
constants.USER_ACCOUNT_EMAIL, None, password_token=constants.USER_PASSWORD_TOKEN
)
except authentication.AuthenticationError as err:
logger.debug(f"Password token auth failure ({err}). Trying with saved session.")
logger.info(f"Password token auth failure ({err}). Trying with saved session.")
if not community_auth.is_initialized():
# try with saved credentials if any
has_tentacles = tentacles_manager_api.is_tentacles_architecture_valid()
Expand Down
1 change: 1 addition & 0 deletions octobot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@

# logs
LOGS_FOLDER = "logs"
FORCED_LOG_LEVEL = os.getenv("FORCED_LOG_LEVEL", "")
ENV_TRADING_ENABLE_DEBUG_LOGS = os_util.parse_boolean_environment_var("ENV_TRADING_ENABLE_DEBUG_LOGS", "False")

# system
Expand Down
7 changes: 6 additions & 1 deletion octobot/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public
# License along with OctoBot. If not, see <https://www.gnu.org/licenses/>.
import logging
import logging.config as config
import os
import shutil
import traceback
import logging.config as config

import sys
import async_channel.channels as channel_instances
Expand Down Expand Up @@ -91,6 +91,11 @@ def _load_logger_config():
os.mkdir(commons_constants.USER_FOLDER)
shutil.copyfile(constants.LOGGING_CONFIG_FILE, configuration_manager.get_user_local_config_file())
config.fileConfig(configuration_manager.get_user_local_config_file())
if constants.FORCED_LOG_LEVEL:
logging.getLogger("Logging Configuration").info(
f"Applying forced logging level {constants.FORCED_LOG_LEVEL}"
)
common_logging.set_global_logger_level(constants.FORCED_LOG_LEVEL)
except Exception as ex:
config.fileConfig(constants.LOGGING_CONFIG_FILE)
logging.getLogger("Logging Configuration").warning(f"Impossible to initialize local logging configuration file,"
Expand Down
Loading