Skip to content

More consistent logging #1534

Open
Open
@fabianegli

Description

@fabianegli

Description of feature

There seems to be undesirable variation in how the nf_core/main.py script handles logging before the various sys.exit(1) codes. i.e. sometimes no logging, sometimes logging to log.error and sometimes to log.critical.

This is a list of except -> ... -> sys.exit(1) code snippets (sys.exit(1) is not shown for brevity):

240
    except LookupError as e:
        log.error(e)

320
    except UserWarning as e:
        log.error(e)

331
    except AssertionError as e:
        log.critical(e)

334
    except UserWarning as e:
        log.error(e)

361
    except LookupError as e:
        log.critical(e)

389
    except UserWarning as e:
        log.critical(e)

414
    except UserWarning as e:
        log.critical(e)

445
    except UserWarning as e:
        log.error(e)

494
    except UserWarning as e:
        log.error(e)

518
    except UserWarning as e:
        log.critical(e)

560
    except UserWarning as e:
        log.critical(e)

583
    except UserWarning as e:
        log.critical(e)

613
    except nf_core.modules.lint.ModuleLintException as e:
        log.error(e)

616
    except UserWarning as e:
        log.critical(e)

648
    except UserWarning as e:
        log.error(e)

668
    except nf_core.modules.module_utils.ModuleException as e:
        log.error(e)

671
    except UserWarning as e:
        log.critical(e)

727
    except UserWarning as e:
        log.critical(e)

745
    except AssertionError as e:
        log.error(e)

749
    except AssertionError as e:
        [no logging]

786
    except (UserWarning, AssertionError) as e:
        log.error(e)

813
    except AssertionError as e:
        [no logging]

849
    except AssertionError as e:
        log.error(e)

893
    except UserWarning as e:
        log.error(e)

934
    except (nf_core.sync.SyncException, nf_core.sync.PullRequestException) as e:
        log.error(e)

There are also incidents of sys.exit(1) after an if statement. Also with seemingly inconsistent logging.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions