#-*- coding: utf-8 -*-
########################################################################
import logging
import datetime
from datetime import datetime
import time
import os
import sys
lis=0


class system(object):
    """"""

    #----------------------------------------------------------------------
    def __init__(self):
        """Constructor"""
    def log(self):   
#	filepath=raw_input(u'输入文件')
	if not os.path.isdir('c:\\TEST_log\\test\\'):
		os.makedirs('c:\\TEST_log\\test\\')
	logFileName = 'c:\\TEST_log\\test\\%s.log' %time.strftime("%m-%d-%H-%M-%S",time.localtime(time.time()))
	logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', filename=logFileName, level=logging.DEBUG)
	
	#################################################################################################
	#定义一个StreamHandler，将INFO级别或更高的日志信息打印到标准错误，并将其添加到当前的日志处理对象#
	console = logging.StreamHandler()
	console.setLevel(logging.INFO)
	formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
	console.setFormatter(formatter)
	logging.getLogger('').addHandler(console)
	#################################################################################################
	
	
	logging.info('####################')
	logging.info('#    Begin Test    #')
	logging.info('####################')
        
    def FileName(self):
	global lis
	lis=lis+1
	filesave='c:\\screenshot\\'
	picname= '%s.png'%(datetime.utcnow().strftime('%m-%d-') + time.strftime('%H',time.localtime(time.time()))+datetime.utcnow().strftime('.%M.%S.')+datetime.utcnow().strftime('%f')[:3])
#	print filesave
#	picname= '%s.png'%(datetime.utcnow().strftime('%m-%d-%H:%M:%S:') + datetime.utcnow().strftime('%f')[:3])
#	print picname
	filename=filesave+picname
#	print filename
	return filename    
    def strB2Q(self,ustring):
	    """半角转全角"""
	    rstring = ""
	    for uchar in ustring:
		    inside_code=ord(uchar)
		    if inside_code == 32:                                 #半角空格直接转化                  
			    inside_code = 12288
		    elif inside_code >= 32 and inside_code <= 126:        #半角字符（除空格）根据关系转化
			    inside_code += 65248
		    rstring += unichr(inside_code)
	    return rstring    