Skip to content
Snippets Groups Projects
Commit 06fdda4b authored by Manuela Kuhn's avatar Manuela Kuhn
Browse files

Added some tests

parent 6f1148b5
No related branches found
No related tags found
No related merge requests found
import logging
def initLogging(filenameFullPath, verbose):
#@see https://docs.python.org/2/howto/logging-cookbook.html
#more detailed logging if verbose-option has been set
loggingLevel = logging.INFO
if verbose:
loggingLevel = logging.DEBUG
#log everything to file
logging.basicConfig(level=loggingLevel,
format='[%(asctime)s] [PID %(process)d] [%(filename)s] [%(module)s:%(funcName)s:%(lineno)d] [%(name)s] [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d_%H:%M:%S',
filename=filenameFullPath,
filemode="a")
#log info to stdout, display messages with different format than the file output
console = logging.StreamHandler()
console.setLevel(logging.WARNING)
formatter = logging.Formatter("%(asctime)s > %(message)s")
console.setFormatter(formatter)
logging.getLogger("").addHandler(console)
#enable logging
initLogging("/space/projects/live-viewer/test/cbf_test.log", True)
logging.debug("Test")
import fabio
#import fabio.cbfimage
#from fabio.cbfimage import cbfimage
def fun_a():
raise Exception
print "I'm here"
fun_a()
print "still here"
import logging
#import fabio
#import fabio.cbfimage
#from fabio.cbfimage import cbfimage
def initLogging(filenameFullPath, verbose):
#@see https://docs.python.org/2/howto/logging-cookbook.html
#more detailed logging if verbose-option has been set
loggingLevel = logging.INFO
if verbose:
loggingLevel = logging.DEBUG
#log everything to file
logging.basicConfig(level=loggingLevel,
format='[%(asctime)s] [PID %(process)d] [%(filename)s] [%(module)s:%(funcName)s:%(lineno)d] [%(name)s] [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d_%H:%M:%S',
filename=filenameFullPath,
filemode="a")
#log info to stdout, display messages with different format than the file output
console = logging.StreamHandler()
console.setLevel(logging.WARNING)
formatter = logging.Formatter("%(asctime)s > %(message)s")
console.setFormatter(formatter)
logging.getLogger("").addHandler(console)
#enable logging
initLogging("/space/projects/live-viewer/test/cbf_test.log", True)
logging.info("Test")
#path = "/space/projects/live-viewer/jan_015_00001.cbf"
#fileFormat = path.rsplit(".", 2)[1]
#print fileFormat
#cbf_file = fabio.cbfimage.cbfimage()
##cbf_file = fabio.cbfimage.cbfimage(fname=path)
#
#cbf_file.read(path)
#
#dict_to_send = cbf_file.header
#dict_to_send[u"data"] = cbf_file.data
#print dict_to_send
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment