Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/logging print nargs #581

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/rez/tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
test importing logging modules.

Mostly for
"""
from rez.tests.util import TestBase
import rez.vendor.unittest2 as unittest
from rez.utils import logging_


class TestLogging(TestBase):

def test_print(self):
"""Test valid msg and nargs combinations for print_*."""
for msg in ("Hello", "Hello %s", "Hello %s %s"):
logging_.print_debug(msg)
logging_.print_info(msg)
logging_.print_warning(msg)
logging_.print_error(msg)
logging_.print_critical(msg)

for nargs in ([], ["foo"], ["foo", "bar"]):
logging_.print_debug(msg, *nargs)
logging_.print_info(msg, *nargs)
logging_.print_warning(msg, *nargs)
logging_.print_error(msg, *nargs)
logging_.print_critical(msg, *nargs)
10 changes: 5 additions & 5 deletions src/rez/utils/logging_.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@


def print_debug(msg, *nargs):
logger.debug(msg % nargs)
logger.debug(msg, *nargs)


def print_info(msg, *nargs):
logger.info(msg % nargs)
logger.info(msg, *nargs)


def print_warning(msg, *nargs):
logger.warning(msg % nargs)
logger.warning(msg, *nargs)


def print_error(msg, *nargs):
logger.error(msg % nargs)
logger.error(msg, *nargs)


def print_critical(msg, *nargs):
logger.critical(msg % nargs)
logger.critical(msg, *nargs)


def get_debug_printer(enabled=True):
Expand Down