Modules or Package for my application

Stone phracek2 at gmail.com
Tue Nov 27 03:04:03 EST 2012


Dear developers,

I am creating application (originally written in perl) 
which will take care about replication from one system to the another system over command rsync. It will simulate High-availability solution.

The application will contains main module called like ha.py
and another modules will have names Replication.py, Trace.py, Misc.py, Procs.py, Constants.py, Lan.py, Display.py

My questions are:
1) When I would like to make a global logging to the one file is it enough to do that like
TRACE='/var/ha/log/sso_trace.log'
logger = logging.getLogger('sso')
hdrl = logging.FileHandler(TRACE)
formatter = logging.Formatter('%{asctime}s %{levelname}s %{message}s')
hdrl.setFormatter(formatter)
logger.addHandler(hdrl)
logger.setLevel(logging.WARNING)
and make for them one module or how to solve that?
How to call that logger from all modules / packages?
Is it necessary to create alone module?

2) Is it package necessary or simply modules are enough
- Replication.py will take care about alone replication
- Procs.py will take care about some processes
- Constants.py will take care about definition of global constants
- Lan.py will take care about LAN definition
- Dipslay.py will take care about showing screen (GUI or text_based)
3) How / where to define global variables?

best regards
Petr



More information about the Python-list mailing list