本文整理汇总了Python中terane.loggers.getLogger函数的典型用法代码示例。如果您正苦于以下问题:Python getLogger函数的具体用法?Python getLogger怎么用?Python getLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLogger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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)
示例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
示例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.
示例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
示例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']
示例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)
示例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():
示例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
示例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():
示例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)
示例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
示例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):
示例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