本文整理汇总了Python中twext.python.log.Logger类的典型用法代码示例。如果您正苦于以下问题:Python Logger类的具体用法?Python Logger怎么用?Python Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_willLogAtLevel
def test_willLogAtLevel(self):
"""
willLogAtLevel()
"""
log = Logger()
for level in logLevels:
if cmpLogLevels(level, log.level()) < 0:
self.assertFalse(log.willLogAtLevel(level))
else:
self.assertTrue(log.willLogAtLevel(level))
开发者ID:azbarcea,项目名称:calendarserver,代码行数:11,代码来源:test_log.py
示例2: test_logMethodTruthiness_Logger
def test_logMethodTruthiness_Logger(self):
"""
Logger's log level functions/methods have true/false
value based on whether they will log.
"""
log = Logger()
for level in logLevels:
enabled = getattr(log, level + "_enabled")
if enabled:
self.assertTrue(log.willLogAtLevel(level))
else:
self.assertFalse(log.willLogAtLevel(level))
开发者ID:azbarcea,项目名称:calendarserver,代码行数:13,代码来源:test_log.py
示例3: emit
def emit(self, level, format=None, **kwargs):
if False:
print "*"*60
print "level =", level
print "format =", format
for key, value in kwargs.items():
print key, "=", value
print "*"*60
def observer(event):
self.event = event
twistedLogging.addObserver(observer)
try:
Logger.emit(self, level, format, **kwargs)
finally:
twistedLogging.removeObserver(observer)
self.emitted = {
"level": level,
"format": format,
"kwargs": kwargs,
}
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:23,代码来源:test_log.py
示例4: Logger
# limitations under the License.
##
from twext.python.log import Logger
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.names import dns
from twisted.names.authority import BindAuthority
from twisted.names.client import getResolver
from twisted.names.error import DomainError, AuthoritativeDomainError
from twistedcaldav.config import config
import socket
log = Logger()
DebugResolver = None
def getIPsFromHost(host):
"""
Map a hostname to an IPv4 or IPv6 address.
@param host: the hostname
@type host: C{str}
@return: a C{set} of IPs
"""
ips = set()
# Use AF_UNSPEC rather than iterating (socket.AF_INET, socket.AF_INET6)
开发者ID:eventable,项目名称:CalendarServer,代码行数:31,代码来源:utils.py
示例5: Logger
from pycalendar.datetime import DateTime
from pycalendar.duration import Duration
from twext.enterprise.dal.record import fromTable
from twext.enterprise.dal.syntax import Delete, Select
from twext.enterprise.jobqueue import WorkItem, RegeneratingWorkItem
from twext.python.log import Logger
from twisted.internet.defer import inlineCallbacks, returnValue, succeed
from twistedcaldav.config import config
from txdav.caldav.datastore.scheduling.icalsplitter import iCalSplitter
from txdav.caldav.datastore.sql import CalendarStoreFeatures, ComponentUpdateState
from txdav.common.datastore.sql_tables import schema
import datetime
import hashlib
log = Logger()
class GroupCacherPollingWork(
RegeneratingWorkItem,
fromTable(schema.GROUP_CACHER_POLLING_WORK)
):
group = "group_cacher_polling"
@classmethod
def initialSchedule(cls, store, seconds):
def _enqueue(txn):
return GroupCacherPollingWork.reschedule(txn, seconds)
if config.InboxCleanup.Enabled:
开发者ID:nunb,项目名称:calendarserver,代码行数:30,代码来源:groups.py
示例6: Logger
from twext.python.log import Logger
from twisted.internet import reactor, protocol
from twisted.internet.defer import inlineCallbacks, Deferred, returnValue
from twisted.web import http_headers
from twisted.web.client import Agent
from twisted.web.http import MOVED_PERMANENTLY, TEMPORARY_REDIRECT, FOUND
from urlparse import urlparse
from urlparse import urlunparse
__all__ = [
"getURL",
]
log = Logger()
class AccumulatingProtocol(protocol.Protocol):
"""
L{AccumulatingProtocol} is an L{IProtocol} implementation which collects
the data delivered to it and can fire a Deferred when it is connected or
disconnected.
@ivar made: A flag indicating whether C{connectionMade} has been called.
@ivar data: A string giving all the data passed to C{dataReceived}.
@ivar closed: A flag indicated whether C{connectionLost} has been called.
@ivar closedReason: The value of the I{reason} parameter passed to
C{connectionLost}.
@ivar closedDeferred: If set to a L{Deferred}, this will be fired when
C{connectionLost} is called.
"""
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:31,代码来源:geturl.py
示例7: Logger
"propertyName",
]
from twisted.python.failure import Failure
from twisted.internet.defer import deferredGenerator, waitForDeferred
from twext.python.log import Logger
from twext.web2.http import HTTPError
from twext.web2 import responsecode
from twext.web2.http import StatusResponse
from txdav.xml import element as davxml
from twext.web2.dav.http import MultiStatusResponse, statusForFailure, \
ErrorResponse
from twext.web2.dav.util import normalizeURL, davXMLFromStream
log = Logger()
def http_PROPFIND(self, request):
"""
Respond to a PROPFIND request. (RFC 2518, section 8.1)
"""
if not self.exists():
log.err("File not found: %s" % (self,))
raise HTTPError(responsecode.NOT_FOUND)
#
# Check authentication and access controls
#
x = waitForDeferred(self.authorize(request, (davxml.Read(),)))
yield x
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:31,代码来源:propfind.py
示例8: Logger
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.python.failure import Failure
from twext.web2 import responsecode
from txdav.xml import element as davxml
from twext.web2.dav.http import MultiStatusResponse, PropertyStatusResponseQueue
from twext.web2.dav.util import davXMLFromStream
from twext.web2.dav.util import parentForURL
from twext.web2.http import HTTPError, StatusResponse
from twext.python.log import Logger
from twext.web2.dav.http import ErrorResponse
from twistedcaldav import caldavxml
log = Logger()
@inlineCallbacks
def http_MKCALENDAR(self, request):
"""
Respond to a MKCALENDAR request.
(CalDAV-access-09, section 5.3.1)
"""
#
# Check authentication and access controls
#
parent = (yield request.locateResource(parentForURL(request.uri)))
yield parent.authorize(request, (davxml.Bind(),))
if self.exists():
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:30,代码来源:mkcalendar.py
示例9: Logger
]
import string
from twisted.internet.defer import deferredGenerator, waitForDeferred
from twext.python.log import Logger
from twext.web2 import responsecode
from twext.web2.http import HTTPError, StatusResponse
from twext.web2.dav.http import ErrorResponse
from twext.web2.dav.util import davXMLFromStream
from txdav.xml import element as davxml
from txdav.xml.element import lookupElement
from txdav.xml.base import encodeXMLName
log = Logger()
max_number_of_matches = 500
class NumberOfMatchesWithinLimits(Exception):
def __init__(self, limit):
super(NumberOfMatchesWithinLimits, self).__init__()
self.limit = limit
def maxLimit(self):
return self.limit
def http_REPORT(self, request):
开发者ID:anemitz,项目名称:calendarserver,代码行数:31,代码来源:report.py
示例10: Logger
from twisted.python.reflect import namedClass
from twext.python.log import Logger
from calendarserver.provision.root import RootResource
from twistedcaldav import memcachepool
from twistedcaldav.config import config, ConfigurationError
from twistedcaldav.directory import augment, calendaruserproxy
from twistedcaldav.directory.aggregate import AggregateDirectoryService
from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord
from twistedcaldav.notify import installNotificationClient
from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
from txdav.common.datastore.file import CommonDataStore
log = Logger()
def loadConfig(configFileName):
if configFileName is None:
configFileName = DEFAULT_CONFIG_FILE
if not os.path.isfile(configFileName):
raise ConfigurationError("No config file: %s" % (configFileName,))
config.load(configFileName)
return config
def getDirectory():
class MyDirectoryService (AggregateDirectoryService):
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:31,代码来源:util.py
示例11: Logger
from Crypto.Hash import SHA, SHA256
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
import base64
import hashlib
import os
import textwrap
import time
import uuid
"""
DKIM HTTP message generation and validation,
"""
log = Logger()
# DKIM/iSchedule Constants
RSA1 = "rsa-sha1"
RSA256 = "rsa-sha256"
Q_DNS = "dns/txt"
Q_HTTP = "http/well-known"
Q_PRIVATE = "private-exchange"
KEY_SERVICE_TYPE = "ischedule"
# Headers
DKIM_SIGNATURE = "DKIM-Signature"
ISCHEDULE_VERSION = "iSchedule-Version"
ISCHEDULE_VERSION_VALUE = "1.0"
ISCHEDULE_MESSAGE_ID = "iSchedule-Message-ID"
开发者ID:nunb,项目名称:calendarserver,代码行数:31,代码来源:dkim.py
示例12: Logger
__all__ = ["DAVFile"]
from twisted.python.filepath import InsecurePath
from twisted.internet.defer import succeed, deferredGenerator, waitForDeferred
from twext.python.log import Logger
from txweb2 import http_headers
from txweb2 import responsecode
from txweb2.dav.resource import DAVResource, davPrivilegeSet
from txweb2.dav.resource import TwistedGETContentMD5
from txweb2.dav.util import bindMethods
from txweb2.http import HTTPError, StatusResponse
from txweb2.static import File
log = Logger()
try:
from txweb2.dav.xattrprops import xattrPropertyStore as DeadPropertyStore
except ImportError:
log.info("No dead property store available; using nonePropertyStore.")
log.info("Setting of dead properties will not be allowed.")
from txweb2.dav.noneprops import NonePropertyStore as DeadPropertyStore
class DAVFile (DAVResource, File):
"""
WebDAV-accessible File resource.
Extends txweb2.static.File to handle WebDAV methods.
"""
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:30,代码来源:static.py
示例13: Logger
from twisted.internet.defer import inlineCallbacks, returnValue
from twext.web2 import responsecode
from twext.web2.dav.util import allDataFromStream, parentForURL
from twext.web2.http import HTTPError, StatusResponse
from twext.python.log import Logger
from twext.web2.dav.http import ErrorResponse
from twistedcaldav.caldavxml import caldav_namespace
from twistedcaldav.method.put_common import StoreCalendarObjectResource
from twistedcaldav.resource import isPseudoCalendarCollectionResource
from twistedcaldav.static import CalDAVFile
log = Logger()
from twistedcaldav.carddavxml import carddav_namespace
from twistedcaldav.method.put_addressbook_common import StoreAddressObjectResource
from twistedcaldav.resource import isAddressBookCollectionResource
@inlineCallbacks
def http_PUT(self, request):
parentURL = parentForURL(request.uri)
parent = (yield request.locateResource(parentURL))
if isPseudoCalendarCollectionResource(parent):
# Content-type check
content_type = request.headers.getHeader("content-type")
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:30,代码来源:put.py
示例14: Logger
"http_REPORT",
]
import string
from twisted.internet.defer import deferredGenerator, waitForDeferred
from twext.python.log import Logger
from twext.web2 import responsecode
from twext.web2.http import HTTPError, StatusResponse
from twext.web2.dav import davxml
from twext.web2.dav.element.parser import lookupElement
from twext.web2.dav.http import ErrorResponse
from twext.web2.dav.util import davXMLFromStream
log = Logger()
max_number_of_matches = 500
class NumberOfMatchesWithinLimits(Exception):
def __init__(self, limit):
super(NumberOfMatchesWithinLimits, self).__init__()
self.limit = limit
def maxLimit(self):
return self.limit
def http_REPORT(self, request):
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:31,代码来源:report.py
示例15: Logger
from twistedcaldav.cache import _CachedResponseResource
from twistedcaldav.cache import MemcacheResponseCache, MemcacheChangeNotifier
from twistedcaldav.cache import DisabledCache
from twistedcaldav.config import config
from twistedcaldav.extensions import DAVFile, CachingPropertyStore
from twistedcaldav.extensions import DirectoryPrincipalPropertySearchMixIn
from twistedcaldav.extensions import ReadOnlyResourceMixIn
from twistedcaldav.resource import CalDAVComplianceMixIn
from twistedcaldav.resource import CalendarHomeResource, AddressBookHomeResource
from twistedcaldav.directory.principal import DirectoryPrincipalResource
from twistedcaldav.storebridge import CalendarCollectionResource,\
AddressBookCollectionResource, StoreNotificationCollectionResource
from calendarserver.platform.darwin.wiki import usernameForAuthToken
log = Logger()
class RootResource (ReadOnlyResourceMixIn, DirectoryPrincipalPropertySearchMixIn, CalDAVComplianceMixIn, DAVFile):
"""
A special root resource that contains support checking SACLs
as well as adding responseFilters.
"""
useSacls = False
# Mapping of top-level resource paths to SACLs. If a request path
# starts with any of these, then the list of SACLs are checked. If the
# request path does not start with any of these, then no SACLs are checked.
saclMap = {
"addressbooks" : ("addressbook",),
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:30,代码来源:root.py
示例16: emit
def emit(self, level, message, *args, **kwargs):
if message.startswith("Unhandled unsolicited response:"):
return
Logger.emit(self, level, message, *args, **kwargs)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:5,代码来源:inbound.py
示例17: Logger
from calendarserver.accesslog import DirectoryLogWrapperResource
from calendarserver.provision.root import RootResource
from calendarserver.tools.util import checkDirectory
from calendarserver.webadmin.resource import WebAdminResource
from calendarserver.webcal.resource import WebCalendarResource
from txdav.common.datastore.sql import CommonDataStore as CommonSQLDataStore
from txdav.common.datastore.file import CommonDataStore as CommonFileDataStore
from txdav.common.datastore.sql import current_sql_schema
from txdav.common.datastore.upgrade.sql.upgrade import NotAllowedToUpgrade
from twext.python.filepath import CachingFilePath
from urllib import quote
from twisted.python.usage import UsageError
log = Logger()
def pgServiceFromConfig(config, subServiceFactory, uid=None, gid=None):
"""
Construct a L{PostgresService} from a given configuration and subservice.
@param config: the configuration to derive postgres configuration
parameters from.
@param subServiceFactory: A factory for the service to start once the
L{PostgresService} has been initialized.
@param uid: The user-ID to run the PostgreSQL server as.
@param gid: The group-ID to run the PostgreSQL server as.
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:31,代码来源:util.py
示例18: import
from os import close
from errno import EAGAIN, ENOBUFS
from socket import (socketpair, fromfd, error as SocketError, AF_UNIX,
SOCK_STREAM, SOCK_DGRAM)
from zope.interface import Interface
from twisted.internet.abstract import FileDescriptor
from twisted.internet.protocol import Protocol, Factory
from twext.python.log import Logger
from twext.python.sendmsg import sendmsg, recvmsg
from twext.python.sendfd import sendfd, recvfd
from twext.python.sendmsg import getsockfam
log = Logger()
class InheritingProtocol(Protocol, object):
"""
When a connection comes in on this protocol, stop reading and writing, and
dispatch the socket to another process via its factory.
"""
def connectionMade(self):
"""
A connection was received; transmit the file descriptor to another
process via L{InheritingProtocolFactory} and remove my transport from
the reactor.
"""
开发者ID:anemitz,项目名称:calendarserver,代码行数:31,代码来源:sendfdport.py
示例19: Logger
##
import os
import re
import sys
import base64
from subprocess import Popen, PIPE, STDOUT
from hashlib import md5, sha1
from twisted.internet import ssl, reactor
from twisted.web import client
from twisted.python import failure
from twext.python.log import LoggingMixIn, Logger
log = Logger()
from twext.internet.gaiendpoint import GAIEndpoint
##
# System Resources (Memory size and processor count)
##
try:
from ctypes import *
import ctypes.util
hasCtypes = True
except ImportError:
hasCtypes = False
if sys.platform == "darwin" and hasCtypes:
libc = cdll.LoadLibrary(ctypes.util.find_library("libc"))
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:31,代码来源:util.py
示例20: Logger
from pycalendar.datetime import DateTime
import datetime
import hashlib
import traceback
__all__ = [
"ScheduleOrganizerWork",
"ScheduleReplyWork",
"ScheduleReplyCancelWork",
"ScheduleRefreshWork",
"ScheduleAutoReplyWork",
]
log = Logger()
class ScheduleWorkMixin(WorkItem):
"""
Base class for common schedule work item behavior. Sub-classes have their own class specific data
stored in per-class tables. This class manages a SCHEDULE_WORK table that contains the work id, job id
and iCalendar UID. That table is used for locking all scheduling items with the same UID, as well as
allow smart re-scheduling/ordering etc of items with the same UID.
"""
# Track when all work is complete (needed for unit tests)
_allDoneCallback = None
_queued = 0
开发者ID:nunb,项目名称:calendarserver,代码行数:29,代码来源:work.py
注:本文中的twext.python.log.Logger类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论