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

Python loggers.getLogger函数代码示例

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

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



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

示例1: configure

 def configure(self, ns):
     # load configuration
     section = ns.section("syslog")
     self.nprocs = section.getInt("num processes", None)
     self.port = section.getInt("listen port", 10514)
     # configure server logging
     logconfigfile = section.getString('log config file', "%s.logconfig" % ns.appname)
     getLogger('tornado')
     if section.getBoolean("debug", False):
         startLogging(StdoutHandler(), DEBUG, logconfigfile)
     else:
         startLogging(None)
     self.handler = TCPHandler(max_buffer_size=65535)
开发者ID:msfrank,项目名称:terane-toolbox,代码行数:13,代码来源:server.py


示例2: getLogger

# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import datetime, calendar, dateutil.tz, re
from zope.interface import implements
from terane.plugins import ILoadable, IPlugin, Plugin
from terane.bier.interfaces import IField
from terane.bier.matching import Term, Phrase, RangeGreaterThan, RangeLessThan
from terane.loggers import getLogger

logger = getLogger('terane.bier.schema')

class SchemaError(Exception):
    pass

class QualifiedField(object):
    """
    """
    def __init__(self, fieldname, fieldtype, field):
        self.fieldname = unicode(fieldname)
        self.fieldtype = unicode(fieldtype)
        self.field = field

    def parseValue(self, value):
        return self.field.parseValue(value)
开发者ID:msfrank,项目名称:terane,代码行数:30,代码来源:fields.py


示例3: getLogger

# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Terane.  If not, see <http://www.gnu.org/licenses/>.

import os, sys, datetime, dateutil.tz, xmlrpclib
from getpass import getpass
from logging import StreamHandler, DEBUG, Formatter
from pprint import pformat
from twisted.web.xmlrpc import Proxy
from twisted.web.error import Error as TwistedWebError
from twisted.internet import reactor
from terane.bier.evid import EVID
from terane.loggers import getLogger, startLogging, StdoutHandler, DEBUG

logger = getLogger('terane.commands.search.searcher')

class Searcher(object):
    def configure(self, settings):
        # load configuration
        section = settings.section("search")
        self.host = section.getString("host", 'localhost:45565')
        self.username = section.getString("username", None)
        self.password = section.getString("password", None)
        if section.getBoolean("prompt password", False):
            self.password = getpass("Password: ")
        self.limit = section.getInt("limit", 100)
        self.reverse = section.getBoolean("display reverse", False)
        self.longfmt = section.getBoolean("long format", False)
        self.indices = section.getList(str, "use indices", None)
        self.tz = section.getString("timezone", None)
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:searcher.py


示例4: getLogger

# (at your option) any later version.
#
# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import os, sys, getopt
from ConfigParser import RawConfigParser
from terane.loggers import getLogger
from terane import versionstring

logger = getLogger("terane.settings")


class ConfigureError(Exception):
    """
    Configuration parsing failed.
    """

    pass


class Option(object):
    def __init__(self, shortname, longname, section, override, help=None, metavar=None):
        self.shortname = shortname
        self.shortident = "%s:" % shortname
        self.longname = longname
开发者ID:msfrank,项目名称:terane,代码行数:31,代码来源:settings.py


示例5: getLogger

# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import time, datetime, calendar, copy
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.task import cooperate
from terane.bier.interfaces import IIndex, ISearcher, IPostingList, IEventStore
from terane.bier.evid import EVID
from terane.loggers import getLogger

logger = getLogger('terane.bier.searching')

class SearcherError(Exception):
    pass

class Period(object):
    """
    A time range within which to constain a query.
    """
    def __init__(self, start, end, startexcl, endexcl):
        """
        :param start: The start of the time range.
        :type start: :class:`datetime.datetime`
        :param end: The end of the time range.
        :type end: :class:`datetime.datetime`
        :param startexcl: If True, then the start of the range is exclusive.
开发者ID:msfrank,项目名称:terane,代码行数:31,代码来源:searching.py


示例6: getLogger

# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

from pkg_resources import Environment, working_set
from terane.loggers import getLogger

logger = getLogger("terane.plugin")

class IPlugin(object):

    def __init__(self, *args, **kwargs):
        pass

    def configure(self, section):
        pass

    def init(self):
        pass

    def fini(self):
        pass
开发者ID:msfrank,项目名称:terane-toolbox,代码行数:30,代码来源:plugin.py


示例7: getLogger

# 
# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

from twisted.internet import reactor
from terane.toolbox.admin.command import AdminCommand
from terane.api.context import ApiContext
from terane.api.sink import DescribeSinkRequest
from terane.loggers import getLogger

logger = getLogger('terane.toolbox.admin.sink.show')

class ShowSinkCommand(AdminCommand):
    """
    """
    def configure(self, ns):
        (name,) = ns.getArgs(str, names=["NAME"], maximum=1)
        self.name = name
        AdminCommand.configure(self, ns)

    def printResult(self, sink):
        name = sink['name']
        del sink['name']
        print "  name: " + name
        sinkType = sink['sinkType']
        del sink['sinkType']
开发者ID:msfrank,项目名称:terane-toolbox,代码行数:31,代码来源:show.py


示例8: getLogger

import time, datetime, pickle
from threading import Lock
from uuid import UUID, uuid4, uuid5
from zope.interface import implements
from twisted.internet.defer import succeed
from terane.bier import IIndex
from terane.bier.evid import EVID, EVID_MIN
from terane.bier.fields import SchemaError
from terane.outputs.store import backend
from terane.outputs.store.segment import Segment
from terane.outputs.store.searching import IndexSearcher
from terane.outputs.store.writing import IndexWriter
from terane.loggers import getLogger

logger = getLogger('terane.outputs.store.index')

class Index(backend.Index):
    """
    Stores events, which are a collection of fields.  Internally, an Index is
    made up of multiple Segments.  Instantiation opens the Index, creating it
    if necessary.  The index will be created in the specified environment, and
    thus protected transactionally.

    :param env: The DB environment.
    :type env: :class:`terane.db.backend.Env`
    :param name: The name of the index.
    :type name: str
    """

    implements(IIndex)
开发者ID:msfrank,项目名称:terane,代码行数:30,代码来源:index.py


示例9: getLogger

# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

from terane.plugin import IPlugin
from terane.event import FieldIdentifier
from terane.loggers import getLogger

logger = getLogger('terane.sinks.debug')

class DebugSink(IPlugin):
    """
    Dump received events to stdout.
    """

    def __str__(self):
        return "DebugSink()"

    def consume(self, event):
        if event.id == None:
            print "-"
        else:
            print event.id
        for (fieldname,fieldtype),value in event.items():
开发者ID:msfrank,项目名称:terane-toolbox,代码行数:31,代码来源:debug.py


示例10: getLogger

# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import re, time, dateutil.parser
from zope.interface import implements
from terane.plugins import Plugin, IPlugin
from terane.filters import Filter, IFilter, FilterError
from terane.bier.event import Contract
from terane.loggers import getLogger

logger = getLogger("terane.filters.syslog")

class SyslogFilter(Filter):

    implements(IFilter)

    def configure(self, section):
        self._linematcher = re.compile(r'(?P<ts>[A-Za-z]{3} [ \d]\d \d\d:\d\d\:\d\d) (?P<hostname>\S*) (?P<msg>.*)')
        self._tagmatcher = re.compile(r'^(\S+)\[(\d+)\]:$|^(\S+):$')
        self._contract = Contract()
        self._contract.addAssertion(u'syslog_pid', u'int', guarantees=False)
        self._contract.addAssertion(u'syslog_tag', u'text', guarantees=False)
        self._contract.sign()

    def getContract(self):
        return self._contract
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:syslog.py


示例11: getLogger

# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import pickle
from zope.interface import implements
from terane.registry import getRegistry
from terane.bier import IField, ISchema
from terane.bier.fields import QualifiedField
from terane.loggers import getLogger

logger = getLogger('terane.outputs.store.schema')

class Schema(object):

    implements(ISchema)

    def __init__(self, index, fieldstore):
        self._index = index
        self._fields = {}
        self._fieldstore = fieldstore
        # load schema data from the db
        with self._index.new_txn() as txn:
            for fieldname,fieldspec in self._index.iter_fields(txn):
                self._fields[fieldname] = pickle.loads(str(fieldspec))
                # verify that the field type is consistent
                for fieldtype,stored in self._fields[fieldname].items():
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:schema.py


示例12: getLogger

# 
# You should have received a copy of the GNU General Public License
# along with Terane.  If not, see <http://www.gnu.org/licenses/>.

import os, sys, urwid
from dateutil.parser import parse
from xmlrpclib import Fault
from twisted.web.xmlrpc import Proxy
from terane.bier.evid import EVID
from terane.commands.console.switcher import Window
from terane.commands.console.results import ResultsListbox
from terane.commands.console.console import console
from terane.commands.console.ui import useMainThread
from terane.loggers import getLogger

logger = getLogger('terane.commands.console.tail')

class Tailer(Window):
    def __init__(self, args):
        title = "Tail '%s'" % args
        self._query = args
        self._lastId = None
        self._results = ResultsListbox()
        self.interval = 2
        self._url = "http://%s/XMLRPC" % console.host
        self._user = console.username
        self._pass = console.password
        self._delayed = None
        self._deferred = None
        logger.debug("using proxy url %s" % self._url)
        Window.__init__(self, title, self._results)
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:tail.py


示例13: getLogger

# You should have received a copy of the GNU General Public License
# along with Terane.  If not, see <http://www.gnu.org/licenses/>.

import os, sys
from twisted.internet.defer import Deferred
from twisted.spread.pb import PBClientFactory, DeadReferenceError
from twisted.cred.credentials import Anonymous
from twisted.internet import reactor
from twisted.python.failure import Failure
from zope.interface import implements
from terane.plugins import Plugin, IPlugin
from terane.outputs import Output, IOutput
from terane.loggers import getLogger
from terane.stats import getStat

logger = getLogger('terane.outputs.forward')

class ForwardOutput(Output):

    implements(IOutput)

    def configure(self, section):
        self.forwardserver = section.getString('forwarding address', None)
        self.forwardport = section.getInt('forwarding port', None)
        self.retryinterval = section.getInt('retry interval', 10)
        self.forwardedevents = getStat("terane.output.%s.forwardedevents" % self.name, 0)
        self.stalerefs = getStat("terane.output.%s.stalerefs" % self.name, 0)
        
    def startService(self):
        Output.startService(self)
        self._client = None
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:forward.py


示例14: getLogger

# 
# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import pyparsing as pp
from terane.bier.matching import Every, AND, OR, NOT
from terane.bier.ql.term import subjectTerm
from terane.bier.ql.date import subjectDate
from terane.loggers import getLogger

logger = getLogger('terane.bier.ql.queries')

def _parseNotGroup(tokens):
    return NOT(tokens[0][0])

def _parseAndGroup(tokens):
    tokens = tokens[0]
    q = tokens[0]
    if len(tokens) > 1:
        i = 1
        while i < len(tokens):
            q = AND([q, tokens[i]])
            i += 1
    return q

def _parseOrGroup(tokens):
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:queries.py


示例15: getLogger

# 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import bisect
from zope.interface import implements
from twisted.internet.defer import inlineCallbacks, returnValue, succeed, fail
from terane.bier.interfaces import IMatcher, IPostingList
from terane.bier.event import Contract
from terane.bier.evid import EVID
from terane.loggers import getLogger

logger = getLogger('terane.bier.matching')

class QueryTerm(object):

    implements(IMatcher)

    def __init__(self, fieldname, fieldtype, fieldfunc, value):
        """
        :param fieldname: The name of the field to search.
        :type fieldname: str
        :param value: The term to search for in the field.
        :type value: unicode
        """
        self.fieldname = fieldname
        self.fieldtype = fieldtype
        self.fieldfunc = fieldfunc
开发者ID:msfrank,项目名称:terane,代码行数:31,代码来源:matching.py


示例16: getLogger

# 
# You should have received a copy of the GNU General Public License
# along with Terane.  If not, see <http://www.gnu.org/licenses/>.

import os, sys, urwid
from dateutil.parser import parse
from xmlrpclib import Fault
from twisted.web.xmlrpc import Proxy
from terane.bier.evid import EVID
from terane.commands.console.switcher import Window
from terane.commands.console.results import ResultsListbox
from terane.commands.console.console import console
from terane.commands.console.ui import useMainThread
from terane.loggers import getLogger

logger = getLogger('terane.commands.console.search')

class Searcher(Window):
    def __init__(self, args):
        # configure the searcher
        title = "Search results for '%s'" % args
        self._query = args
        self._results = ResultsListbox()
        self._url = "http://%s/XMLRPC" % console.host
        self._user = console.username
        self._pass = console.password
        self._deferred = None
        Window.__init__(self, title, self._results)

    def startService(self):
        Window.startService(self)
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:search.py


示例17: getLogger

import sys, traceback
from terane.toolbox.admin.action import ActionMap,Action
from terane.toolbox.admin.route.append import AppendRouteCommand
from terane.toolbox.admin.source.create import CreateSyslogUdpSourceCommand, CreateSyslogTcpSourceCommand
from terane.toolbox.admin.source.delete import DeleteSourceCommand
from terane.toolbox.admin.source.list import ListSourcesCommand
from terane.toolbox.admin.source.show import ShowSourceCommand
from terane.toolbox.admin.sink.create import CreateCassandraSinkCommand
from terane.toolbox.admin.sink.delete import DeleteSinkCommand
from terane.toolbox.admin.sink.list import ListSinksCommand
from terane.toolbox.admin.sink.show import ShowSinkCommand
from terane.settings import Option, LongOption, Switch, ConfigureError
from terane.loggers import getLogger

logger = getLogger('terane.toolbox.admin')

actions = ActionMap(usage="[OPTIONS...] COMMAND", description="Terane cluster administrative commands", section="admin", options=[
    Option("H", "host", override="host", help="Connect to terane server HOST", metavar="HOST"),
    Option("u", "username", override="username", help="Authenticate with username USER", metavar="USER"),
    Option("p", "password", override="password", help="Authenticate with password PASS", metavar="PASS"),
    Switch("P", "prompt-password", override="prompt password", help="Prompt for a password"),
    LongOption("log-config", override="log config file", help="use logging configuration file FILE", metavar="FILE"),
    Switch("d", "debug", override="debug", help="Print debugging information")], actions=[
    Action("route", usage="COMMAND", description="Manipulate routes in a Terane cluster", actions=[
        Action("append", callback=None,
               usage="ROUTE",
               description="Append ROUTE to the routing table"),
        Action("insert", callback=None,
               usage="POSITION ROUTE",
               description="Insert ROUTE at the specified POSITION in the routing table"),
开发者ID:msfrank,项目名称:terane-toolbox,代码行数:30,代码来源:__init__.py


示例18: getLogger

# You should have received a copy of the GNU General Public License
# along with Terane.  If not, see <http://www.gnu.org/licenses/>.

import time
from zope.interface import Interface, implements
from twisted.internet.defer import succeed
from twisted.python.failure import Failure
from terane.manager import IManager, Manager
from terane.registry import getRegistry
from terane.routes import IIndexStore
from terane.bier.evid import EVID
from terane.bier.ql import parseIterQuery, parseTailQuery
from terane.bier.searching import searchIndices, Period, SearcherError
from terane.loggers import getLogger

logger = getLogger('terane.queries')

class QueryExecutionError(Exception):
    """
    There was an error while executing the plan.
    """
    pass

class QueryResult(object):
    """
    The result from executing a query method.  A QueryResult consists of the data
    itself, which is a list of results; and metadata, which is a mapping of keys to
    values.
    """

    def __init__(self, meta={}, data=[]):
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:queries.py


示例19: getLogger

# Terane 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 Terane.  If not, see <http://www.gnu.org/licenses/>.

import re, time, email.utils, datetime
from zope.interface import implements
from terane.plugins import Plugin, IPlugin
from terane.filters import Filter, IFilter, FilterError, StopFiltering
from terane.bier.event import Contract, Assertion
from terane.loggers import getLogger

logger = getLogger("terane.filters.datetime")

class RFC2822DatetimeFilter(Filter):
    """
    Given an event field with a RFC2822-compatible datetime string, convert the
    string to a datetime.datetime and store it as the event ts.
    """

    implements(IFilter)

    def configure(self, section):
        self._fieldname = section.getString('source field', 'rfc2822_date')
        self._expected = section.getBoolean('expects source', False)
        self._guaranteed = section.getBoolean('guarantees source', False)
        self._contract = Contract()
        self._contract.addAssertion( unicode(self._fieldname), u'text',
开发者ID:DSDev-NickHogle,项目名称:terane,代码行数:31,代码来源:dt.py


示例20: getLogger

# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Terane.  If not, see <http://www.gnu.org/licenses/>.

import time
import cPickle as pickle
from zope.interface import implements
from twisted.internet.defer import succeed
from twisted.internet.threads import deferToThread
from terane.bier import IWriter
from terane.bier.fields import QualifiedField
from terane.bier.writing import WriterError
from terane.loggers import getLogger

logger = getLogger('terane.outputs.store.writing')

class WriterExpired(WriterError):
    pass

class IndexWriter(object):

    implements(IWriter)

    def __init__(self, ix):
        self._ix = ix
        logger.trace("[writer %s] waiting for segmentLock" % self)
        with ix._segmentLock:
            logger.trace("[writer %s] acquired segmentLock" % self)
            self._segment = ix._current
        logger.trace("[writer %s] released segmentLock" % self)
开发者ID:msfrank,项目名称:terane,代码行数:31,代码来源:writing.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python term.Term类代码示例发布时间:2022-05-27
下一篇:
Python tephi.Tephigram类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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