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 logger initialization #1316

Merged
merged 1 commit into from
Jan 25, 2018
Merged
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
26 changes: 18 additions & 8 deletions libcodechecker/cmd/cmd_line_client.py
Original file line number Diff line number Diff line change
@@ -30,7 +30,14 @@
from libcodechecker.util import split_server_url


LOG = logger.get_logger('system')
# Needs to be set in the handler functions.
LOG = None


def init_logger(level, logger_name='system'):
logger.setup_logger(level)
global LOG
LOG = logger.get_logger(logger_name)


class CmdLineOutputEncoder(json.JSONEncoder):
@@ -105,7 +112,8 @@ def add_filter_conditions(report_filter, filter_str):


def handle_list_runs(args):
logger.setup_logger(args.verbose)

init_logger(args.verbose)

client = setup_client(args.product_url)
runs = client.getRunData(None)
@@ -126,7 +134,8 @@ def handle_list_runs(args):


def handle_list_results(args):
logger.setup_logger(args.verbose)

init_logger(args.verbose)

client = setup_client(args.product_url)

@@ -178,7 +187,7 @@ def handle_list_results(args):

def handle_diff_results(args):

logger.setup_logger(args.verbose)
init_logger(args.verbose)

context = generic_package_context.get_context()

@@ -573,7 +582,8 @@ def print_reports(client, reports, output_format):


def handle_list_result_types(args):
logger.setup_logger(args.verbose)

init_logger(args.verbose)

def get_statistics(client, run_ids, field, values):
report_filter = ttypes.ReportFilter()
@@ -681,7 +691,7 @@ def checker_count(checker_dict, key):

def handle_remove_run_results(args):

logger.setup_logger(args.verbose)
init_logger(args.verbose)

client = setup_client(args.product_url)

@@ -731,7 +741,7 @@ def condition(name, runid, date):

def handle_suppress(args):

logger.setup_logger(args.verbose)
init_logger(args.verbose)

def bug_hash_filter(bug_id, filepath):
filepath = '%' + filepath
@@ -762,7 +772,7 @@ def bug_hash_filter(bug_id, filepath):

def handle_login(args):

logger.setup_logger(args.verbose)
init_logger(args.verbose)

protocol, host, port = split_server_url(args.server_url)
handle_auth(protocol, host, port, args.username,
17 changes: 13 additions & 4 deletions libcodechecker/cmd/product_client.py
Original file line number Diff line number Diff line change
@@ -20,12 +20,19 @@

from cmd_line_client import CmdLineOutputEncoder

# Needs to be set in the handler functions.
LOG = None

LOG = logger.get_logger('system')

def init_logger(level, logger_name='system'):
logger.setup_logger(level)
global LOG
LOG = logger.get_logger(logger_name)


def handle_list_products(args):
logger.setup_logger(args.verbose)

init_logger(args.verbose)

protocol, host, port = split_server_url(args.server_url)
client = setup_product_client(protocol, host, port)
@@ -59,7 +66,8 @@ def handle_list_products(args):


def handle_add_product(args):
logger.setup_logger(args.verbose)

init_logger(args.verbose)

protocol, host, port = split_server_url(args.server_url)
client = setup_product_client(protocol, host, port)
@@ -110,7 +118,8 @@ def handle_add_product(args):


def handle_del_product(args):
logger.setup_logger(args.verbose)

init_logger(args.verbose)

protocol, host, port = split_server_url(args.server_url)
client = setup_product_client(protocol, host, port)