From 1d6b441b9653c02db8ba057cad40c8cff6c8c5bb Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 9 Aug 2017 18:01:33 -0400 Subject: [PATCH] Convert license print statements to logger Change-Id: I0597053944aef49b9537fd8d492781fa76c05ad0 Signed-off-by: Thanh Ha Signed-off-by: Jeremy Phelps --- lftools/license.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lftools/license.py b/lftools/license.py index 32bb9554..52bbf5ac 100644 --- a/lftools/license.py +++ b/lftools/license.py @@ -13,10 +13,13 @@ __author__ = 'Thanh Ha' +import logging import os import re import sys +log = logging.getLogger(__name__) + def get_header_text(_file): """Scan a file and pulls out the license header. @@ -53,7 +56,7 @@ def check_license(license_file, code_file): code_header = get_header_text(code_file) if not license_header in code_header: - print('ERROR: {} is missing or has incorrect license header.'.format(code_file)) + log.error('{} is missing or has incorrect license header.'.format(code_file)) return 1 return 0 @@ -72,4 +75,4 @@ def check_license_directory(license_file, directory, regex=".+\.py$"): if missing_license: sys.exit(1) - print('Scan completed did not detect any files missing license headers.') + log.info('Scan completed did not detect any files missing license headers.') -- 2.16.6