Metadata-Version: 2.1
Name: heatbit_logger
Version: 0.1.6
Summary: Common logger
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: sentry-sdk==1.31.0

    from heatbit.logger import setup_logger

    logger = setup_logger('foo')


# for development:

 - install dependencies
    pip install -r requirements.txt -i https://apt.internal.heatbit.com/pypi/simple/ --extra-index-url https://pypi.python.org/simple/
 - install pre-commit
    pre-commit install


# init_sentry:

    from heatbit.logger import init_sentry

    init_sentry(miner_id)


The environment variable `CURRENT_ENVIRONMENT` must contain current environment (development, production, etc.).
If the variable is absent no report will be sent to Sentry

The environment variable `SENTRY_DSN` must contain Sendry DSN. If it absent ValueError will raised.

The file with db is located on the path `/home/pi/errors.db`. Path can be changed by environment variable `SENTRY_REPORTS_DB_FILENAME`.

By default, the logger for tracking error events writes them to the `/var/log/heatbit/sentry_reports.log` file.
To change this logger, pass another logger as the keyword parameter to init_sentry:

    from heatbit.logger import setup_logger
    other_logger = setup_logger("new_file_name")

    init_sentry(miner_id, logger=other_logger)
