This guide provides instructions for migrating projects from LogLama to LogLama.
The LogLama package has been renamed to LogLama to better align with the PyLama ecosystem naming convention. This guide will help you update your projects to use the new package name.
We’ve provided a migration script that can automatically update your codebase to use LogLama instead of LogLama.
# Install LogLama if you haven't already
pip install loglama
# Run the migration script in report-only mode first to see what would change
python migrate_to_loglama.py --path /path/to/your/project --report-only --verbose
# When you're ready to make the changes, run without the --report-only flag
python migrate_to_loglama.py --path /path/to/your/project --verbose
The script will:
import loglama
to import loglama
loglama.xyz
to loglama.xyz
loglama
to use loglama
insteadloglama_get_logger()
to loglama_get_logger()
LOGLAMA_
to LOGLAMA_
loglama_config.json
to loglama_config.json
loglama
in their namesIf you prefer to manually update your code or if the migration script doesn’t catch everything, here’s a checklist of items to update:
import loglama
to import loglama
loglama.xyz
to loglama.xyz
loglama
to use loglama
insteadloglama_get_logger()
to loglama_get_logger()
LOGLAMA_
to LOGLAMA_
loglama_config.json
to loglama_config.json
loglama_diagnostic_report.json
to loglama_diagnostic_report.json
loglama
instead of loglama
loglama
If you need to maintain compatibility with both LogLama and LogLama during a transition period, you can use the following pattern:
try:
import loglama as logging_lib
except ImportError:
import loglama as logging_lib
# Then use logging_lib throughout your code
logger = logging_lib.get_logger(__name__)
If your application relies on environment variables with the LOGLAMA_
prefix, you’ll need to update your environment configuration files (.env files, Docker environment variables, CI/CD secrets, etc.) to use the LOGLAMA_
prefix.
If you’re using the SQLite handler, the database schema remains the same, so existing log databases will continue to work with LogLama.
The web interface URL has changed from /loglama/
to /loglama/
. Update any bookmarks or links accordingly.
If you encounter any issues during migration, please open an issue on the LogLama GitHub repository.
After migration, verify that logging works correctly by running your application and checking that logs are being generated as expected.
from loglama import get_logger
logger = get_logger(__name__)
logger.info("If you can see this message in your logs, LogLama is working correctly!")