Skip to content

Commit 76d9eed

Browse files
author
Janneke van der Zwaan
committed
Add logging example
Fixes #9
1 parent 9d53dec commit 76d9eed

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

{{cookiecutter.project_slug}}/project_setup.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ Package version number
124124
* 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.
125125
* Don't forget to update the version number before `making a release <https://guide.esciencecenter.nl/best_practices/releases.html>`_!
126126

127+
128+
Logging
129+
-------
130+
131+
* We recommend using the `logging` module for getting useful information from your module (instead of using `print`).
132+
* The project is set up with a logging example.
133+
* `Relevant section in the guide <https://guide.esciencecenter.nl/best_practices/language_guides/python.html#logging>`_
134+
127135
CHANGELOG.rst
128136
-------------
129137

@@ -159,4 +167,4 @@ NOTICE
159167
------
160168

161169
* List of attributions of this project and Apache-license dependencies
162-
* `Relevant section in the guide <https://guide.esciencecenter.nl/best_practices/licensing.html#notice>`_
170+
* `Relevant section in the guide <https://guide.esciencecenter.nl/best_practices/licensing.html#notice>`_
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# -*- coding: utf-8 -*-
22
{% if cookiecutter.apidoc == 'yes' %}"""Documentation about {{ cookiecutter.project_name }}"""{% endif %}
3+
import logging
34

45
from .__version__ import __version__
56

7+
logging.getLogger(__name__).addHandler(logging.NullHandler())
8+
69
__author__ = "{{ cookiecutter.full_name.replace('\"', '\\\"') }}"
710
__email__ = '{{ cookiecutter.email }}'
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# -*- coding: utf-8 -*-
22
{%-if cookiecutter.apidoc == 'yes' %}"""Documentation about the {{ cookiecutter.project_name }} module."""{% endif %}
3+
import logging
4+
5+
logger = logging.getLogger(__name__)
36

47

58
# FIXME: put actual code here
69
def example():
7-
pass
10+
logger.info('Providing information about the excecution of the function.')

0 commit comments

Comments
 (0)