karenc / db-migrator

GNU Affero General Public License v3.0
4 stars 5 forks source link

Change --verbose to set the logger level to debug #26

Closed karenc closed 8 years ago

karenc commented 8 years ago

There are a lot of prints in db-migrator, like if I run this:

$ dbmigrator -v --db-connection-string='dbname=cnxarchive user=cnxarchive' list
context undefined, using current directory name "['db-migrator']"
migrations directory undefined
[DEBUG] dbmigrator (cli.py) - args: {'verbose': True, 'config': None, 'migrations_directory': [], 'db_connection_string': 'dbname=cnxarchive user=cnxarchive', 'cmmd': <function cli_command at 0x7f24f9295488>, 'context': ['db-migrator']}

^ "context undefined, ...", "migrations directory undefined", "args: {'verbose': True ...}"

I have a formatter for the logger

handler.setFormatter(logging.Formatter(
    '[%(levelname)s] %(name)s (%(filename)s) - %(message)s'))

makes me wonder if I should have a different logger without this formatter, or continue to use print, or something else?

mmulich commented 8 years ago

The use of the logger is good. It's a known interface that we can work against and with in future cases. So, no reason to go back to using print.

Looks good and creates a good place for future info to hang off.

mmulich commented 8 years ago

Removing the levelname from the log line might be good, but we'll see if it annoys anyone. :)