datalad / datalad-extension-template

Minimal implementation of a DataLad extension module
http://datalad.org
Other
2 stars 17 forks source link

Harmonize logging name (to datalad.helloworld)? #27

Closed yarikoptic closed 2 years ago

yarikoptic commented 2 years ago

In this repo there is no template/example/instructions on what should be the name of the logger.

We have varying usages:

(git)lena:~datalad/datalad-mihextras[master]git
$> git grep getLog.*ext
datalad_mihextras/export_bagit.py:lgr = logging.getLogger('datalad.mihextras.export_bagit')
datalad_mihextras/export_to_webdav.py:lgr = logging.getLogger('datalad.mihextras.export_to_webdav')

(git)lena:~datalad/datalad-deprecated[master]git
$> git grep getLog.*depre
datalad_deprecated/sibling_webui.py:lgr = logging.getLogger('datalad_deprecated.sibling_webui')

(git)lena:~datalad/datalad-osf[master]git
$> git grep getLog.*osf  
datalad_osf/create_sibling_osf.py:lgr = logging.getLogger('datalad.osf.create_sibling_osf')

Because likely everyone should have extensions logging to be consistent with the logging of the datalad setup itself (the same handlers etc), the logging target name should indeed have datalad. prefix (so we should fix up datalad-deprecated https://github.com/datalad/datalad-deprecated/pull/50 and may be others).

But concern might be -- potentially to not overlap with a similar name in the datalad core? I.e. do have a collision between extension name and module in datalad core. Since we are only talking about logging name, I think it is not a big deal if they collide. Alternatively extensions could use datalad.ext.<extension>.

In either case, this template should either have an example or document that (or both).