Skip to content

Instantly share code, notes, and snippets.

@cbonesana
Created March 6, 2025 12:49
Show Gist options
  • Save cbonesana/07dc7a008db08ec88003d11c9400f8c7 to your computer and use it in GitHub Desktop.
Save cbonesana/07dc7a008db08ec88003d11c9400f8c7 to your computer and use it in GitHub Desktop.
...
version: 1
disable_existing_loggers: true
formatters:
standard_formatter:
format: "%(asctime)s %(levelname)7s %(name)s: %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
handlers:
console:
formatter: standard_formatter
class: logging.StreamHandler
stream: ext://sys.stdout
files:
formatter: standard_formatter
class: logging.handlers.RotatingFileHandler
filename: raptor.log
mode: w
loggers:
raptor:
handlers:
- console
- files
level: DEBUG
propagate: false
__main__:
handlers:
- console
- files
level: DEBUG
propagate: false
openai:
level: ERROR
handlers:
- console
httpx:
level: ERROR
root:
level: ERROR
propagate: false
import os
import yaml
import logging
import logging.config
if os.path.exists("logging.yaml"):
with open("logging.yaml", "r") as f_conf:
logging_config = yaml.safe_load(f_conf)
logging.config.dictConfig(logging_config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment