Skip to content

Commit

Permalink
Merge pull request #171 from atomicals/feat/env-log-level
Browse files Browse the repository at this point in the history
🚸 Configurable `LOG_LEVEL` with `.env`
  • Loading branch information
atomicals authored Apr 25, 2024
2 parents e196d72 + 58511b5 commit a90c3a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion electrumx_server
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ load_dotenv()
def main():
'''Set up logging and run the server.'''
log_fmt = Env.default('LOG_FORMAT', '%(levelname)s:%(name)s:%(message)s')
log_level = Env.default('LOG_LEVEL', 'INFO')
log_path = Env.default('LOG_PATH', None)
if log_path:
exist =os.path.exists(log_path)
Expand All @@ -34,7 +35,7 @@ def main():
else:
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(CompactFormatter(log_fmt))
logger = make_logger('electrumx', handler=handler, level='INFO')
logger = make_logger('electrumx', handler=handler, level=log_level)

logger.info('ElectrumX server starting')
try:
Expand Down

0 comments on commit a90c3a3

Please sign in to comment.