From: Joe Guo Date: Wed, 22 Aug 2018 04:42:12 +0000 (+1200) Subject: emulate/traffic: apply new logger to replace print X-Git-Tag: tdb-1.3.17~1372 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8a1773ce238cef8735ddcd445e591c33e17d37e;p=thirdparty%2Fsamba.git emulate/traffic: apply new logger to replace print These print are actually progress infomation, should use logger to print to stderr, other than stdout. Signed-off-by: Joe Guo Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index 5ecb9afe57e..35100ca0c0f 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -51,6 +51,7 @@ from samba.dcerpc.misc import SEC_CHAN_BDC from samba import gensec from samba import sd_utils from samba.compat import get_string +from samba.logger import get_samba_logger SLEEP_OVERHEAD = 3e-4 @@ -89,6 +90,8 @@ NO_WAIT_LOG_TIME_RANGE = (-10, -3) # DEBUG_LEVEL can be changed by scripts with -d DEBUG_LEVEL = 0 +LOGGER = get_samba_logger(name=__name__) + def debug(level, msg, *args): """Print a formatted debug message to standard error. @@ -1438,7 +1441,7 @@ def replay(conversations, end = start + duration - print("Replaying traffic for %u conversations over %d seconds" + LOGGER.info("Replaying traffic for %u conversations over %d seconds" % (len(conversations), duration)) children = {} @@ -1672,7 +1675,7 @@ def create_machine_account(ldb, instance_id, netbios_name, machinepass): "unicodePwd": utf16pw}) end = time.time() duration = end - start - print("%f\t0\tcreate\tmachine\t%f\tTrue\t" % (end, duration)) + LOGGER.info("%f\t0\tcreate\tmachine\t%f\tTrue\t" % (end, duration)) def create_user_account(ldb, instance_id, username, userpass): @@ -1695,7 +1698,7 @@ def create_user_account(ldb, instance_id, username, userpass): end = time.time() duration = end - start - print("%f\t0\tcreate\tuser\t%f\tTrue\t" % (end, duration)) + LOGGER.info("%f\t0\tcreate\tuser\t%f\tTrue\t" % (end, duration)) def create_group(ldb, instance_id, name): @@ -1711,7 +1714,7 @@ def create_group(ldb, instance_id, name): }) end = time.time() duration = end - start - print("%f\t0\tcreate\tgroup\t%f\tTrue\t" % (end, duration)) + LOGGER.info("%f\t0\tcreate\tgroup\t%f\tTrue\t" % (end, duration)) def user_name(instance_id, i):