Skip to content

Commit

Permalink
Add logging example
Browse files Browse the repository at this point in the history
Fixes #9
  • Loading branch information
Janneke van der Zwaan committed Jul 17, 2019
1 parent 9d53dec commit 76d9eed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion {{cookiecutter.project_slug}}/project_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ Package version number
* For convenience, the package version is stored in a single place: ``{{ cookiecutter.project_slug }}/__version__.py``. For updating the version number, you only have to change this file.
* Don't forget to update the version number before `making a release <https://guide.esciencecenter.nl/best_practices/releases.html>`_!


Logging
-------

* We recommend using the `logging` module for getting useful information from your module (instead of using `print`).
* The project is set up with a logging example.
* `Relevant section in the guide <https://guide.esciencecenter.nl/best_practices/language_guides/python.html#logging>`_

CHANGELOG.rst
-------------

Expand Down Expand Up @@ -159,4 +167,4 @@ NOTICE
------

* List of attributions of this project and Apache-license dependencies
* `Relevant section in the guide <https://guide.esciencecenter.nl/best_practices/licensing.html#notice>`_
* `Relevant section in the guide <https://guide.esciencecenter.nl/best_practices/licensing.html#notice>`_
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
{% if cookiecutter.apidoc == 'yes' %}"""Documentation about {{ cookiecutter.project_name }}"""{% endif %}
import logging

from .__version__ import __version__

logging.getLogger(__name__).addHandler(logging.NullHandler())

__author__ = "{{ cookiecutter.full_name.replace('\"', '\\\"') }}"
__email__ = '{{ cookiecutter.email }}'
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
{%-if cookiecutter.apidoc == 'yes' %}"""Documentation about the {{ cookiecutter.project_name }} module."""{% endif %}
import logging

logger = logging.getLogger(__name__)


# FIXME: put actual code here
def example():
pass
logger.info('Providing information about the excecution of the function.')

0 comments on commit 76d9eed

Please sign in to comment.