コード例 #1
0
ファイル: chatmodule.py プロジェクト: ChanR-Analytics/Watson
 def g(f):
     if not syntaxes:
         raise ValueError(
             "Must provide at least one valid syntax for each command")
     f.command_syntaxes = syntaxes
     f.command_grammars = []
     f.storable = options.get("storable", True)
     for syntax in syntaxes:
         f.command_grammars += create_grammars(syntax)
     return f
コード例 #2
0
ファイル: chatbot.py プロジェクト: B-Rich/Watson
 def __init__(self, name="Watson", command_names=(), log_file='/var/log/chatbot.log', log_level=logging.INFO):
     self._modules = {}
     self._commands = {}
     self.state = State(self)
     self.welcome_phrase = self.welcome_phrase % name
     self.command_grammars = create_grammars("/".join(command_names) + " <phrase>")
     
     formatter = logging.Formatter('[%(asctime)s %(levelname)s] - %(message)s')
     
     handler = logging.FileHandler(log_file)
     handler.setFormatter(formatter)
     
     self.logger = logging.getLogger("watson")
     self.logger.addHandler(handler)
     self.logger.setLevel(log_level)
コード例 #3
0
ファイル: chatbot.py プロジェクト: ChanR-Analytics/Watson
    def __init__(self,
                 name="Watson",
                 command_names=(),
                 log_file='/var/log/chatbot.log',
                 log_level=logging.INFO):
        self._modules = {}
        self._commands = {}
        self.state = State(self)
        self.welcome_phrase = self.welcome_phrase % name
        self.command_grammars = create_grammars("/".join(command_names) +
                                                " <phrase>")

        formatter = logging.Formatter(
            '[%(asctime)s %(levelname)s] - %(message)s')

        handler = logging.FileHandler(log_file)
        handler.setFormatter(formatter)

        self.logger = logging.getLogger("watson")
        self.logger.addHandler(handler)
        self.logger.setLevel(log_level)