• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.Log类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.Log的典型用法代码示例。如果您正苦于以下问题:Python Log类的具体用法?Python Log怎么用?Python Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Log类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: post

    def post(self):
        user_id = self.get_argument("uid", None)
        title = self.get_argument("title", "")
        link = self.get_argument("link", "")
        profile = self.get_argument("profile", True)
        tags = self.get_argument("tags", "").split(" ")
        description = self.get_argument("description", "")
        image_path = self.get_argument("Filedata.path", None)
        image_name = self.get_argument("Filedata.name", None)
        image_md5 = self.get_argument("Filedata.md5", None)
        image_size = self.get_argument("Filedata.size", None)
        categories = self.get_argument("categories", None)
        
        if not user_id: return
        user_id = int(user_id)
        if not image_path: return
        
        name, ext = os.path.splitext(image_name)
        response = upload_crop(image_path, ext)
        if not response["status"]: return

        source_path = response["source_path"].split("/upload/")[1]
        thumb_path = response["thumb_path"].split("/upload/")[1]
        middle_path = response["middle_path"].split("/upload/")[1]
        width = response["width"]
        height = response["height"]
        
        entry = self.entry_dal.template()
        entry["user_id"] = user_id
        entry["user"] = self.entry_dal.dbref("users", user_id)
        entry["title"] = title
        entry["link"] = link
        entry["profile"] = profile
        entry["tags"] = tags
        entry["description"] = description
        entry["source"] = source_path
        entry["thumb"] = thumb_path
        entry["middle"] = middle_path
        entry["height"] = height
        entry["width"] = width
        entry["md5"] = image_md5
        entry["size"] = image_size

        if categories:
            entry["categories"] = [int(item.strip()) 
                                   for item in categories.split(",") 
                                   if item.strip()]

        if title:
            title = title.encode("utf-8", "ignore")
            keywords = [seg for seg in seg_txt_search(title) if len(seg) > 1]
            if len(tags) and tags[0]:
                keywords = keywords + tags
            entry["_keywords"] = keywords

        try:
            self.entry_dal.save(entry)
            self.user_dal.update_entries_count(user_id)
        except Exception, ex:
            Log.error(ex)
开发者ID:chu888chu888,项目名称:Python-Tornado-diggit,代码行数:60,代码来源:entry.py


示例2: process

 def process(self):
     try:
         self._clear_result()
         self._reduce_comments()
         self._reduce_favers()
     except Exception, ex:
         Log.error(ex, "mapreduce")
开发者ID:beyondboy,项目名称:diggit,代码行数:7,代码来源:mapreduced.py


示例3: __init__

	def __init__(self, filename):
		if(filename[0] != '/'):
			Log.w(TAG, "Filename is not absolute, this may cause issues dispatching jobs.")
		ffprobe = subprocess.Popen(["ffprobe","-v", "quiet", "-print_format", "json", "-show_format", "-show_streams",filename], stdout=subprocess.PIPE)
		#Get everything from stdout once ffprobe exits, and
		try:
			ffprobe_string = ffprobe.communicate()[0]
			self.ffprobe_dict=json.loads(ffprobe_string)
		except ValueError:
			Log.e(TAG, "File could not be read, are you sure it exists?")
		ffmpeg_interlace = subprocess.Popen(["ffmpeg", "-filter:v", "idet", "-frames:v", "400", "-an", "-f", "null", "-", "-i", filename],stdout=subprocess.PIPE, stderr=subprocess.PIPE)
		interlaced_details = ffmpeg_interlace.communicate()[1]
		interlaced_lines = interlaced_details.split("\n")
		num_progressive = 0
		for line in interlaced_lines:
			if line.find("idet") != -1 and line.find("Progressive") != -1:
				#find the number of progressive frames in this line.
				nframes = line.split("Progressive:")[1].split("Undetermined")[0]
				num_progressive = num_progressive + int(nframes)
		if num_progressive < 20:
			self.is_interlaced = True
		self.video_stream = self.parse_video(self.ffprobe_dict)
		self.audio_streams = self.parse_audio(self.ffprobe_dict)
		self.sub_streams = self.parse_subs(self.ffprobe_dict)
		self.file_format = self.ffprobe_dict["format"]["format_name"]
		self.duration = float(self.ffprobe_dict["format"]["duration"])
开发者ID:magmastonealex,项目名称:ffproc,代码行数:26,代码来源:MediaParser.py


示例4: getOptions

    def getOptions(self, section, option):
        """
        Read the preset options of a configuration key.

        @param section:   Section name
        @param option:    Option name
        @return:          Tuple of Key list and Values list
        """

        try:
            options = self.prototype[section][option].options.values()
            keys    = self.prototype[section][option].options.keys()
            type    = self.prototype[section][option].type
        except KeyError:
            Log.error("Config key %s.%s not defined while reading %s." % (section, option, self.fileName))
            raise

        optionList = []

        if type != None:
            for i in range(len(options)):
                value = _convertValue(keys[i], type)
                optionList.append(value)

        return optionList, options
开发者ID:Archangelgray,项目名称:fofix,代码行数:25,代码来源:Config.py


示例5: popLayer

    def popLayer(self, layer):
        Log.debug("View: Pop: %s" % layer.__class__.__name__)

        if layer in self.incoming:
            self.incoming.remove(layer)
        if layer in self.layers and not layer in self.outgoing:
            self.outgoing.append(layer)
开发者ID:EdPassos,项目名称:fofix,代码行数:7,代码来源:View.py


示例6: keyName

 def keyName(value):
     if value in CONTROL1:
         name = "Controller 1"
         control = CONTROL1
         n = 0
     elif value in CONTROL2:
         name = "Controller 2"
         control = CONTROL2
         n = 1
     elif value in CONTROL3:
         name = "Controller 3"
         control = CONTROL3
         n = 2
     else:
         name = "Controller 4"
         control = CONTROL4
         n = 3
     for j in range(20):
         if value == control[j]:
             if self.type[n] == 2:
                 return name + " " + drumkey4names[j]
             elif self.type[n] == 3:
                 return name + " " + drumkey5names[j]
             else:
                 return name + " " + guitarkeynames[j]
     else:
         Log.notice("Key value not found.")
         return "Error"
开发者ID:Archangelgray,项目名称:fofix,代码行数:28,代码来源:Player.py


示例7: __init__

 def __init__(self, engine, controlnum, samprate=44100):
     Task.__init__(self)
     self.engine = engine
     self.controlnum = controlnum
     devnum = self.engine.input.controls.micDevice[controlnum]
     if devnum == -1:
         devnum = None
         self.devname = pa.get_default_input_device_info()['name']
     else:
         self.devname = pa.get_device_info_by_index(devnum)['name']
     self.mic = pa.open(samprate, 1, pyaudio.paFloat32, input=True, input_device_index=devnum, start=False)
     self.analyzer = pypitch.Analyzer(samprate)
     self.mic_started = False
     self.lastPeak    = 0
     self.detectTaps  = True
     self.tapStatus   = False
     self.tapThreshold = -self.engine.input.controls.micTapSensitivity[controlnum]
     self.passthroughQueue = []
     passthroughVolume = self.engine.input.controls.micPassthroughVolume[controlnum]
     if passthroughVolume > 0.0:
         Log.debug('Microphone: creating passthrough stream at %d%% volume' % round(passthroughVolume * 100))
         self.passthroughStream = Audio.MicrophonePassthroughStream(engine, self)
         self.passthroughStream.setVolume(passthroughVolume)
     else:
         Log.debug('Microphone: not creating passthrough stream')
         self.passthroughStream = None
开发者ID:Archangelgray,项目名称:fofix,代码行数:26,代码来源:Microphone.py


示例8: icon_crop

def icon_crop(user_id, icon_path, coords):
    response = {}
    if not os.path.exists(icon_path):
        response["status"] = False
        response["message"] = "Not Found: %s" % icon_path
        return response

    image_path, ext = os.path.splitext(icon_path)
    store_dir = _get_image_dir(ICON_PATH)
    thumb_name = "u%s%s%s" % (user_id, str(int(time.time())), ext)
    thumb_path = os.path.join(store_dir, thumb_name)

    middle_name = "u%s%sb%s" % (user_id, str(int(time.time())), ext)
    middle_path = os.path.join(store_dir, middle_name)

    img = Image.open(icon_path)
    left, top, width, height = tuple([int(i) for i in coords.split("|")])
    box = (left, top, left+width, top+height)
    img_thumb = img.crop(box)

    big_size = (ICON_BIG_WIDTH, ICON_BIG_WIDTH)
    img_thumb = img_thumb.resize(big_size, Image.ANTIALIAS)
    img_thumb.save(middle_path, quality=150)

    thumb_size = (ICON_WIDTH, ICON_WIDTH)
    img_thumb = img_thumb.resize(thumb_size, Image.ANTIALIAS)
    img_thumb.save(thumb_path, quality=150)

    try:
        os.remove(icon_path)
    except Exception, ex:
        Log.info(ex)
开发者ID:zixiao,项目名称:diggit,代码行数:32,代码来源:image.py


示例9: post

 def post(self):
     if not self.request.files:
         self.render("account/icon.html", error=151)
         return
     files = self.request.files["icon"]
     if len(files) == 0:
         self.render("account/icon.html", error=151)
         return
     if files[0]["content_type"].split("/")[1] not in self.image_types:
         self.render("account/icon.html", error=152)
         return
     image_type = files[0]["content_type"].split("/")[1]
     """TODO头像分片存储"""
     ext = os.path.splitext(files[0]["filename"])[1]
     filepath = "u_%s_%s%s" % (self.current_user["_id"], str(int(time.time())), ext)
     file_dir = "%s/%s" % (self.settings["icon_dir"], filepath)
     try:
         writer = open(file_dir, "wb")
         writer.write(files[0]["body"])
         writer.flush()
         writer.close()
     except Exception, ex:
         Log.error(ex)
         self.render("account/icon.html", error=153)
         return
开发者ID:crazyevan,项目名称:diggit,代码行数:25,代码来源:account.py


示例10: loadVideo

    def loadVideo(self, libraryName, songName):
        vidSource = None

        if self.songStage == 1:
            songBackgroundVideoPath = os.path.join(libraryName, songName, "background.ogv")
            if os.path.isfile(songBackgroundVideoPath):
                vidSource = songBackgroundVideoPath
                loop = False
            else:
                Log.warn("Video not found: %s" % songBackgroundVideoPath)

        if vidSource is None:
            vidSource = os.path.join(self.pathfull, "default.ogv")
            loop = True

        if not os.path.isfile(vidSource):
            Log.warn("Video not found: %s" % vidSource)
            Log.warn("Falling back to default stage mode.")
            self.mode = 1 # Fallback
            return

        try: # Catches invalid video files or unsupported formats
            Log.debug("Attempting to load video: %s" % vidSource)
            self.vidPlayer = VideoLayer(self.engine, vidSource,
                                        mute = True, loop = loop)
            self.engine.view.pushLayer(self.vidPlayer)
        except (IOError, VideoPlayerError):
            self.mode = 1
            Log.error("Failed to load song video (falling back to default stage mode):")
开发者ID:Archangelgray,项目名称:fofix,代码行数:29,代码来源:Stage.py


示例11: work2JPG

def work2JPG(filename, isPng = False):
    filepath = FileHelper.realpath(filename)
    filedir = FileHelper.dirname(filepath)
    name = FileHelper.basename(filepath)
  
    os.chdir(tpDir)
 
    jpgCMD = """%s -quality 90 %s %s """ % (convertBin, filepath, filepath)                 
    os.system(jpgCMD)  
    #return           
            
    tmpfilename = FileHelper.join(filedir, hashlib.md5(name.encode('utf-8')).hexdigest())
        
    isSuccess = True
    with open(tmpfilename, 'wb+') as tmpFile:
        try: 
            tmpFile.write(b'MNG')
            
            rgbname = filepath 
            FileHelper.writeWithSize(tmpFile, filepath)      

        except Exception:
            Log.printDetailln ("error00 !!!", filename, "cannot convert.")
            isSuccess = False
        finally: 
            pass
    if isSuccess:        
        FileHelper.remove(filepath)
        FileHelper.rename(tmpfilename, filepath)      
        return 5  
    else:
        return 2                
开发者ID:lyzardiar,项目名称:RETools,代码行数:32,代码来源:PackImgJPG.py


示例12: print

 def print(self):
     if self.empty():
         return
     Log.printDetailln("%s.print:" % (self.name))
     while not self.empty():
         task = self.get()
         ret, *args = task.param
         Log.printDetailln('\t', ret, *args)
开发者ID:lyzardiar,项目名称:RETools,代码行数:8,代码来源:ProcessWork.py


示例13: finishGame

 def finishGame(self):
     if not self.world:
         Log.notice("GameEngine.finishGame called before World created.")
         return
     self.world.finishGame()
     self.world = None
     self.gameStarted = False
     self.view.pushLayer(self.mainMenu)
开发者ID:Archangelgray,项目名称:fofix,代码行数:8,代码来源:GameEngine.py


示例14: start

 def start(self):
     if not self.mic_started:
         self.mic_started = True
         self.mic.start_stream()
         self.engine.addTask(self, synchronized=False)
         Log.debug('Microphone: started %s' % self.devname)
         if self.passthroughStream is not None:
             Log.debug('Microphone: starting passthrough stream')
             self.passthroughStream.play()
开发者ID:Archangelgray,项目名称:fofix,代码行数:9,代码来源:Microphone.py


示例15: remove

    def remove(self):
        """ Remove component with given name.

        Returns True if the component successfully removed.
        """
        Log.debug("Pubkey.remove(): removing")
        self._remove_key()
        super().remove()
        return True
开发者ID:ctldev,项目名称:ctlweb,代码行数:9,代码来源:pubkey.py


示例16: stop

 def stop(self):
     if self.mic_started:
         if self.passthroughStream is not None:
             Log.debug('Microphone: stopping passthrough stream')
             self.passthroughStream.stop()
         self.engine.removeTask(self)
         self.mic.stop_stream()
         self.mic_started = False
         Log.debug('Microphone: stopped %s' % self.devname)
开发者ID:Archangelgray,项目名称:fofix,代码行数:9,代码来源:Microphone.py


示例17: __init__

 def __init__(self, name = None, target = GL_TEXTURE_2D, useMipmaps = True):
     # Delete all pending textures
     try:
         func, args = cleanupQueue[0]
         del cleanupQueue[0]
         func(*args)
     except IndexError:
         pass
     except Exception, e:    #MFH - to catch "did you call glewInit?" crashes
         Log.error("Texture.py texture deletion exception: %s" % e)
开发者ID:Archangelgray,项目名称:fofix,代码行数:10,代码来源:Texture.py


示例18: loadLibrary

 def loadLibrary(self):
     Log.debug("Loading libraries in %s" % self.library)
     self.loaded = False
     self.tiersPresent = False
     if self.splash:
         Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection..."))
     else:
         self.splash = Dialogs.showLoadingSplashScreen(self.engine, _("Browsing Collection..."))
         self.loadStartTime = time.time()
     self.engine.resource.load(self, "libraries", lambda: Song.getAvailableLibraries(self.engine, self.library), onLoad = self.loadSongs, synch = True)
开发者ID:Archangelgray,项目名称:fofix,代码行数:10,代码来源:SongChoosingScene.py


示例19: getSoundObjectList

    def getSoundObjectList(self, soundPath, soundPrefix, numSounds, soundExtension=".ogg"):  # MFH
        Log.debug("{0}1{2} - {0}{1}{2} found in {3}".format(soundPrefix, numSounds, soundExtension, soundPath))

        sounds = []
        for i in xrange(1, numSounds + 1):
            filePath = os.path.join(soundPath, "%s%d%s" % (soundPrefix, i, soundExtension))
            soundObject = Sound(self.resource.fileName(filePath))
            sounds.append(soundObject)

        return sounds
开发者ID:EdPassos,项目名称:fofix,代码行数:10,代码来源:Data.py


示例20: setUp

    def setUp(self):
        """ Establishes database connection
        """
        Database.db_file = "test.db"  # DB File for Testcase without config
        Log.streamoutput()
#        Log.set_verbosity(5)
#       Instance objects
        self.comp = Component("name", "/path/to/exe", 'hash')
        self.connection = Database.db_connection
        self.cursor = self.connection.cursor()
开发者ID:ctldev,项目名称:ctlweb,代码行数:10,代码来源:test_component.py



注:本文中的util.Log类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.Logutil类代码示例发布时间:2022-05-26
下一篇:
Python util.LineBufferFilter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap