Conversation
aperrin66
left a comment
There was a problem hiding this comment.
You need to choose one way to configure logging:
- either use the current mechanism with logger attributes defined for each object using
nansat.utils.add_logger - or use a global logging configuration initialized in
nansat.__init__
No we need both of them because the run can be started with nansat usage as standalone (in that case, we need |
It works exactly the same whether you use nansat alone or with geospaas_harvesting: the "Nansat" logger is created when If you are going to use |
|
@aperrin66 done |
akorosov
left a comment
There was a problem hiding this comment.
Good!
But I don;t see that logging.config, os.path or yaml is used in __init__.py why did you add that?
If it is not used, can you remove it?
| formatter = logging.Formatter('%(asctime)s - %(name)s - %(threadName)s - ' | ||
| '%(levelname)s - %(message)s') |
There was a problem hiding this comment.
You don't need the threadName field, nansat is single-threaded
There was a problem hiding this comment.
actually is there any need to change the format at all?
There was a problem hiding this comment.
In order to make it in a unified format when we start the process from harvesting, this helps to read the logs easily,all levels of nansat,harvesting and run_container.py MUST have same format of log. Because they are unified when call from each other. Reading logs with different format is difficult. so it is better to keep it. The thread is unknown, or sth like that,it does not matter, let it be.
nansat/nansat.py
Outdated
|
|
||
| """ | ||
| logger = add_logger('import_mappers', logLevel=log_level) | ||
| logger = add_logger('Nansat', logLevel=log_level) |
There was a problem hiding this comment.
this function is not part of the Nansat class
There was a problem hiding this comment.
but it is in nansat repository.DO you have any other name in your mind?
There was a problem hiding this comment.
Either leave it as it was or use something like nansat.import_mappers.
Note: nansat refers to the package. Nansat refers to the class.
nansat/mappers/mapper_aapp_l1b.py
Outdated
| from nansat.geolocation import Geolocation | ||
| from nansat.vrt import VRT | ||
|
|
||
| LOGGER = logging.getLogger("Nansat."+__name__) |
There was a problem hiding this comment.
__name__ already contains the full name of the module (here, it isnansat.mappers.mapper_aapp_l1b), so there is no need to prefix it with "Nansat.".
Same thing for the other mappers.
There was a problem hiding this comment.
yes, you are right! But, when we run it from harvesting, only mapper_aapp_l1b is appear! It is better to keep that in the name of the lagger,isn't it?
There was a problem hiding this comment.
Then write the full module name (nansat.mappers.mapper_aapp_l1b), that way there is no ambiguity.
No description provided.