当前位置: 首页>>代码示例>>Python>>正文


Python log.getLogger函数代码示例

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


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

示例1: __init__

 def __init__(self, name, emitter=None):
     self.name = name
     self.bind(emitter)
     self.config_core = ConfigurationManager.get()
     self.config = self.config_core.get(name)
     self.dialog_renderer = None
     self.file_system = FileSystemAccess(join('skills', name))
     self.registered_intents = []
     self.log = getLogger(name)
开发者ID:forslund,项目名称:mycroft-core,代码行数:9,代码来源:core.py

示例2: getLogger

from mycroft.client.enclosure.arduino import EnclosureArduino
from mycroft.client.enclosure.eyes import EnclosureEyes
from mycroft.client.enclosure.mouth import EnclosureMouth
from mycroft.client.enclosure.weather import EnclosureWeather
from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
from mycroft.util import kill, str2bool
from mycroft.util import play_wav
from mycroft.util.log import getLogger
from mycroft.util.audio_test import record

__author__ = 'aatchison + jdorleans + iward'

LOGGER = getLogger("EnclosureClient")


class EnclosureReader(Thread):
    """
    Reads data from Serial port.

    Listens to all commands sent by Arduino that must be be performed on
    Mycroft Core.

    E.g. Mycroft Stop Feature
        #. Arduino sends a Stop command after a button press on a Mycroft unit
        #. ``EnclosureReader`` captures the Stop command
        #. Notify all Mycroft Core processes (e.g. skills) to be stopped

    Note: A command is identified by a line break
开发者ID:bisaysavath,项目名称:mycroft-core,代码行数:30,代码来源:enclosure.py

示例3: getLogger

# (at your option) any later version.
#
# Mycroft Core is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core.  If not, see <http://www.gnu.org/licenses/>.


from mycroft.util.log import getLogger

__author__ = 'jdorleans'

LOGGER = getLogger(__name__)


class EnclosureMouth:
    """
    Listens to enclosure commands for Mycroft's Mouth.

    Performs the associated command on Arduino by writing on the Serial port.
    """

    def __init__(self, client, writer):
        self.client = client
        self.writer = writer
        self.__init_events()

    def __init_events(self):
开发者ID:Acidburn0zzz,项目名称:mycroft-core,代码行数:31,代码来源:mouth.py

示例4: getLogger

import os
import sys
import urllib2
import webbrowser

from adapt.intent import IntentBuilder
from adapt.tools.text.tokenizer import EnglishTokenizer
from mycroft.skills.core import MycroftSkill
from mycroft.util.log import getLogger

logger = getLogger(__name__)
__author__ = 'seanfitz'

IFL_TEMPLATE = "http://www.google.com/search?&sourceid=navclient&btnI=I&q=%s"


class DesktopLauncherSkill(MycroftSkill):
    def __init__(self):
        MycroftSkill.__init__(self, "DesktopLauncherSkill")
        self.appmap = {}

    def initialize(self):
        try:
            import gio
        except:
            sys.path.append("/usr/lib/python2.7/dist-packages")
            try:
                import gio
            except:
                logger.error("Could not import gio")
                return
开发者ID:Alphacodeclub,项目名称:mycroft-core,代码行数:31,代码来源:__init__.py

示例5: getLogger


import subprocess
import sys
from threading import Thread, Lock
import re

from mycroft.client.speech.listener import RecognizerLoop
from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
from mycroft.tts import tts_factory
from mycroft.util.log import getLogger
from mycroft.util import kill, connected

logger = getLogger("SpeechClient")
client = None
tts = tts_factory.create()
mutex = Lock()
loop = None

config = ConfigurationManager.get()


def handle_record_begin():
    logger.info("Begin Recording...")
    client.emit(Message('recognizer_loop:record_begin'))


def handle_record_end():
    logger.info("End Recording...")
开发者ID:bisaysavath,项目名称:mycroft-core,代码行数:29,代码来源:main.py

示例6: Lock

from mycroft.messagebus.message import Message
from mycroft.tts import tts_factory
from mycroft.util.log import getLogger

from xml.dom import minidom
import os

from traceback import print_exc
import dbus.mainloop.glib

from gi.repository import GLib

tts = tts_factory.create()
client = None
mutex = Lock()
logger = getLogger("CLIClient")
guioutputstring = ''

def handle_speak(event):
    mutex.acquire()
    client.emit(Message("recognizer_loop:audio_output_start"))
    try:
        utterance = event.metadata.get('utterance')
        logger.info("Speak: " + utterance)
	global guioutputstring	
	guioutputstring = utterance
	logger.info("guioutputstring: " + guioutputstring)	
	dbusout()	
	tts.execute(utterance)		
    finally:
        mutex.release()
开发者ID:RobbiNespu,项目名称:Mycroft-AI-Gnome-Shell-Extension,代码行数:31,代码来源:guignome.py

示例7: getLogger

import os
import wave
from glob import glob

import pyee
from os.path import dirname, join
from speech_recognition import AudioSource
from mycroft.client.speech.local_recognizer import LocalRecognizer
from mycroft.client.speech.mic import ResponsiveRecognizer
from mycroft.util.log import getLogger
from mycroft.client.speech.mic import logger as speech_logger

__author__ = 'wolfgange3311999'
logger = getLogger('audio_test_runner')


class FileStream(object):
    def __init__(self, file_name):
        self.file = wave.open(file_name, 'rb')
        self.size = self.file.getnframes()
        self.sample_rate = self.file.getframerate()
        self.sample_width = self.file.getsampwidth()

    def read(self, chunk_size):
        if abs(self.file.tell() - self.size) < 10:
            raise EOFError
        return self.file.readframes(chunk_size)

    def close(self):
        self.file.close()
开发者ID:Cadair,项目名称:mycroft-core,代码行数:30,代码来源:audio_accuracy_test.py

示例8: str

from mycroft.util.log import getLogger

__author__ = 'augustnmonteiro'

# The following lines are replaced during the release process.
# START_VERSION_BLOCK
CORE_VERSION_MAJOR = 0
CORE_VERSION_MINOR = 8
CORE_VERSION_BUILD = 18
# END_VERSION_BLOCK

CORE_VERSION_STR = (str(CORE_VERSION_MAJOR) + "." +
                    str(CORE_VERSION_MINOR) + "." +
                    str(CORE_VERSION_BUILD))
LOG = getLogger(__name__)


class VersionManager(object):
    __location = "/opt/mycroft/version.json"

    @staticmethod
    def get():
        if (exists(VersionManager.__location) and
                isfile(VersionManager.__location)):
            try:
                with open(VersionManager.__location) as f:
                    return json.load(f)
            except:
                LOG.error("Failed to load version from '%s'"
                          % VersionManager.__location)
开发者ID:Wolfgange3311999,项目名称:mycroft-core,代码行数:30,代码来源:__init__.py

示例9: getLogger

import json

from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.skills.core import load_skills
from mycroft.util.log import getLogger
logger = getLogger("Skills")

__author__ = 'seanfitz'

client = None


def load_skills_callback():
    global client
    load_skills(client)


def connect():
    global client
    client.run_forever()


def main():
    global client
    client = WebsocketClient()

    def echo(message):
        try:
            _message = json.loads(message)

            if _message.get("message_type") == "registration":
开发者ID:Alphacodeclub,项目名称:mycroft-core,代码行数:31,代码来源:main.py

示例10: MustacheDialogRenderer

# Mycroft Core is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core.  If not, see <http://www.gnu.org/licenses/>.


import pystache
import os
import random
from mycroft.util import log, resolve_resource_file

__author__ = 'seanfitz'
logger = log.getLogger(__name__)

__doc__ = """

"""


class MustacheDialogRenderer(object):
    """
    A dialog template renderer based on the mustache templating language.
    """
    def __init__(self):
        self.templates = {}

    def load_template_file(self, template_name, filename):
        """
开发者ID:ChristopherRogers1991,项目名称:mycroft-core,代码行数:31,代码来源:__init__.py

示例11: getLogger

# along with Mycroft Core.  If not, see <http://www.gnu.org/licenses/>.


import argparse
import sys
from os.path import dirname, exists, isdir

from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.skills.core import create_skill_descriptor, load_skill
from mycroft.skills.intent import Intent
from mycroft.util.log import getLogger

__author__ = 'seanfitz'

LOG = getLogger("SkillContainer")


class SkillContainer(object):
    def __init__(self, args):
        params = self.__build_params(args)

        if params.config:
            ConfigurationManager.load_local([params.config])

        if exists(params.lib) and isdir(params.lib):
            sys.path.append(params.lib)

        sys.path.append(params.dir)
        self.dir = params.dir
开发者ID:jasonehines,项目名称:mycroft-core,代码行数:30,代码来源:container.py

示例12: getLogger

from threading import Thread
from time import sleep

from pyric import pyw
from wifi import Cell

from mycroft.client.enclosure.api import EnclosureAPI
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.messagebus.message import Message
from mycroft.util import connected, wait_while_speaking, is_speaking, \
    stop_speaking
from mycroft.util.log import getLogger

__author__ = 'aatchison and penrods'

LOG = getLogger("WiFiClient")

SCRIPT_DIR = dirname(realpath(__file__))

WPA_SUPPLICANT = '''#mycroft_p2p_start
ctrl_interface=/var/run/wpa_supplicant
driver_param=p2p_device=1
update_config=1
device_name=mycroft-holmes-i
device_type=1-0050F204-1
p2p_go_intent=10
p2p_go_ht40=1

network={
    ssid="MYCROFT"
    psk="12345678"
开发者ID:Holly-Buteau,项目名称:mycroft-core,代码行数:31,代码来源:main.py

示例13: getLogger

import json

import requests
from speech_recognition import UnknownValueError

from mycroft.configuration.config import ConfigurationManager
from mycroft.identity import IdentityManager
from mycroft.metrics import Stopwatch
from mycroft.util import CerberusAccessDenied
from mycroft.util.log import getLogger
from mycroft.util.setup_base import get_version

__author__ = 'seanfitz'

log = getLogger("RecognizerWrapper")

config = ConfigurationManager.get_config().get('speech_client')


class GoogleRecognizerWrapper(object):
    def __init__(self, recognizer):
        self.recognizer = recognizer

    def transcribe(self, audio, language="en-US", show_all=False, metrics=None):
        key = config.get('goog_api_key')
        return self.recognizer.recognize_google(audio, key=key, language=language, show_all=show_all)


class WitRecognizerWrapper(object):
    def __init__(self, recognizer):
        self.recognizer = recognizer
开发者ID:BK-University,项目名称:mycroft-core,代码行数:31,代码来源:recognizer_wrapper.py

示例14: getLogger

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mycroft Core.  If not, see <http://www.gnu.org/licenses/>.
from abc import ABCMeta, abstractmethod

from speech_recognition import Recognizer

from mycroft.api import STTApi
from mycroft.configuration import ConfigurationManager
from mycroft.util.log import getLogger

__author__ = "jdorleans"

LOG = getLogger("STT")


class STT(object):
    __metaclass__ = ABCMeta

    def __init__(self):
        config_core = ConfigurationManager.get()
        self.lang = str(self.init_language(config_core))
        config_stt = config_core.get("stt", {})
        self.config = config_stt.get(config_stt.get("module"), {})
        self.credential = self.config.get("credential", {})
        self.recognizer = Recognizer()

    @staticmethod
    def init_language(config_core):
开发者ID:jasonehines,项目名称:mycroft-core,代码行数:31,代码来源:__init__.py

示例15: getLogger

# along with Mycroft Core.  If not, see <http://www.gnu.org/licenses/>.


import json
import threading
import time
import requests

from mycroft.util import str2bool
from mycroft.util.log import getLogger
from mycroft.configuration import ConfigurationManager
from mycroft.session import SessionManager
from mycroft.util.setup_base import get_version

config = ConfigurationManager.get().get('metrics_client')
metrics_log = getLogger("METRICS")


class Stopwatch(object):
    def __init__(self):
        self.timestamp = None

    def start(self):
        self.timestamp = time.time()

    def lap(self):
        cur_time = time.time()
        start_time = self.timestamp
        self.timestamp = cur_time
        return cur_time - start_time
开发者ID:Acidburn0zzz,项目名称:mycroft-core,代码行数:30,代码来源:__init__.py


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