def test_accessRoot(self): logger.info('== {} =='.format(self._testMethodName)) args = Args() args.toPath = '/' args.logfile = 'rts2-debug' args.level = 'INFO' args.toconsole = False lg = Logger(debug=False, args=args) # it is a weak assertion since Logger is not yet really unittestable (for developemnt purposes only) self.assertIsInstance( obj=lg, cls=Logger, msg='returned object: {} is not of type Logger'.format(type(lg)))
#!/usr/bin/python from rts2saf.log import Logger from rts2saf.rts2exec import Rts2Exec from rts2.json import JSONProxy class Args(object): def __init__(self): pass args = Args() args.toPath = '/var/log' args.logfile = 'rts2-debug' args.level = 'DEBUG' debug = False logger = Logger(debug=debug, args=args).logger proxy = JSONProxy() ex = Rts2Exec(debug=debug, proxy=proxy, logger=logger) ex.reeanableEXEC() logger.info('rts2saf_reenable_exec.py: reenabled EXEC')
# used for test the whole process # there is no environment, specify your absolute path # if you need it #args.dryFitsFiles='YOUR/HOME/rts-2/scripts/rts2saf/samples' # if args.verbose: args.debug = True args.level = 'DEBUG' args.toconsole = True if args.checkConfig: args.toconsole = True # logger logger = Logger( debug=args.debug, args=args).logger # if you need to chage the log format do it here # read the run time configuration rt = Configuration(logger=logger) if not rt.readConfiguration(fileName=args.config): logger.error( 'rts2saf_focus: exiting, wrong syntax, check the configuration file: {0}' .format(args.config)) sys.exit(1) if not rt.checkConfiguration(args=args): logger.error( 'rts2saf_focus: exiting, check the configuration file: {0}'.format( args.config)) sys.exit(1)