Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
05aa5cd0
Commit
05aa5cd0
authored
Jan 22, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the name "logger" to "eventlog". Also rename the loghandler section
types.
parent
b595b063
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
44 deletions
+20
-44
src/ZEO/mkzeoinst.py
src/ZEO/mkzeoinst.py
+2
-2
src/ZEO/runzeo.py
src/ZEO/runzeo.py
+1
-1
src/ZEO/schema.xml
src/ZEO/schema.xml
+1
-1
src/zLOG/component.xml
src/zLOG/component.xml
+4
-13
src/zLOG/datatypes.py
src/zLOG/datatypes.py
+4
-19
src/zLOG/tests/testzLogConfig.py
src/zLOG/tests/testzLogConfig.py
+8
-8
No files found.
src/ZEO/mkzeoinst.py
View file @
05aa5cd0
...
...
@@ -54,12 +54,12 @@ zeo_conf_template = """# ZEO configuration file
path %(home)s/var/Data.fs
</filestorage>
<
logger
>
<
eventlog
>
level info
<logfile>
path %(home)s/log/zeo.log
</logfile>
</
logger
>
</
eventlog
>
"""
runner_conf_template
=
"""# runner configuration file
...
...
src/ZEO/runzeo.py
View file @
05aa5cd0
...
...
@@ -93,7 +93,7 @@ class ZEOOptionsMixin:
class
ZEOOptions
(
ZDOptions
,
ZEOOptionsMixin
):
logsectionname
=
"
logger
"
logsectionname
=
"
eventlog
"
def
__init__
(
self
):
self
.
schemadir
=
os
.
path
.
dirname
(
ZEO
.
__file__
)
...
...
src/ZEO/schema.xml
View file @
05aa5cd0
...
...
@@ -27,6 +27,6 @@
</description>
</multisection>
<section
name=
"*"
type=
"
logger"
attribute=
"logger
"
required=
"no"
/>
<section
name=
"*"
type=
"
eventlog"
attribute=
"eventlog
"
required=
"no"
/>
</schema>
src/zLOG/component.xml
View file @
05aa5cd0
...
...
@@ -27,14 +27,14 @@
datatype=
".log_format"
/>
</sectiontype>
<sectiontype
name=
"
nt
eventlog"
datatype=
".nteventlog_handler"
<sectiontype
name=
"
win32-
eventlog"
datatype=
".nteventlog_handler"
implements=
"loghandler"
extends=
"base-log-handler"
>
<key
name=
"appname"
default=
"Zope"
/>
<key
name=
"format"
default=
"%(message)s"
datatype=
".log_format"
/>
</sectiontype>
<sectiontype
name=
"http
_handl
er"
datatype=
".http_handler"
<sectiontype
name=
"http
-logg
er"
datatype=
".http_handler"
implements=
"loghandler"
extends=
"base-log-handler"
>
<key
name=
"url"
default=
"localhost"
datatype=
".http_handler_url"
/>
<key
name=
"method"
default=
"GET"
datatype=
".get_or_post"
/>
...
...
@@ -42,7 +42,7 @@
datatype=
".log_format"
/>
</sectiontype>
<sectiontype
name=
"
smtp_handl
er"
datatype=
".smtp_handler"
<sectiontype
name=
"
email-notifi
er"
datatype=
".smtp_handler"
implements=
"loghandler"
extends=
"base-log-handler"
>
<key
name=
"fromaddr"
required=
"yes"
/>
<multikey
name=
"toaddr"
required=
"yes"
attribute=
"toaddrs"
/>
...
...
@@ -52,17 +52,8 @@
datatype=
".log_format"
/>
</sectiontype>
<!--
<sectiontype name="custom_handler" datatype=".custom_handler"
implements="loghandler">
<key name="constructor" datatype="constructor" required="yes"/>
<key name="formatter" datatype="constructor"
default="logging.Formatter()"/>
<key name="level" default="info" datatype=".logging_level"/>
</sectiontype>
-->
<sectiontype
name=
"
logger"
datatype=
".logger
"
>
<sectiontype
name=
"
eventlog"
datatype=
".EventLogFactory
"
>
<key
name=
"level"
datatype=
".logging_level"
default=
"all"
/>
<multisection
type=
"loghandler"
attribute=
"handlers"
name=
"*"
/>
</sectiontype>
...
...
src/zLOG/datatypes.py
View file @
05aa5cd0
...
...
@@ -211,25 +211,10 @@ def smtp_handler(section):
section
.
toaddrs
,
section
.
subject
)
## def custom_handler(section):
## formatter_klass, formatter_pos, formatter_kw = section.formatter
## handler_klass, handler_pos, handler_kw = section.constructor
## level = section.level
## formatter = Factory(formatter_klass, None, formatter_pos, formatter_kw)
## def callback(inst, formatter=formatter, level=level):
## inst.setFormatter(formatter())
## inst.setLevel(level)
## return Factory(handler_klass, callback, *handler_pos, **handler_kw)
def
logger
(
section
):
return
LoggerWrapper
(
section
.
level
,
section
.
handlers
)
_marker
=
[]
class
LoggerWrapper
:
class
EventLogFactory
:
"""
A wrapper used to create loggers while delaying actual logger
instance construction. We need to do this because we may
...
...
@@ -238,9 +223,9 @@ class LoggerWrapper:
An instance of this wrapper is a callable which, when called, returns a
logger object.
"""
def
__init__
(
self
,
level
,
handler_factories
):
self
.
level
=
level
self
.
handler_factories
=
handler_factorie
s
def
__init__
(
self
,
section
):
self
.
level
=
section
.
level
self
.
handler_factories
=
section
.
handler
s
self
.
resolved
=
_marker
def
__call__
(
self
):
...
...
src/zLOG/tests/testzLogConfig.py
View file @
05aa5cd0
...
...
@@ -31,7 +31,7 @@ class TestzLOGConfig(unittest.TestCase):
_schematext
=
"""
<schema>
<import package='zLOG'/>
<section type='
logger' name='*' attribute='logger
'/>
<section type='
eventlog' name='*' attribute='eventlog
'/>
</schema>
"""
...
...
@@ -62,10 +62,10 @@ class TestzLOGConfig(unittest.TestCase):
def
test_config_without_logger
(
self
):
conf
=
self
.
get_config
(
""
)
self
.
assert_
(
conf
.
logger
is
None
)
self
.
assert_
(
conf
.
eventlog
is
None
)
def
test_config_without_handlers
(
self
):
logger
=
self
.
check_simple_logger
(
"<
logger
/>"
)
logger
=
self
.
check_simple_logger
(
"<
eventlog
/>"
)
# Make sure there's a NullHandler, since a warning gets
# printed if there are no handlers:
self
.
assertEqual
(
len
(
logger
.
handlers
),
1
)
...
...
@@ -74,12 +74,12 @@ class TestzLOGConfig(unittest.TestCase):
def
test_with_logfile
(
self
):
fn
=
tempfile
.
mktemp
()
logger
=
self
.
check_simple_logger
(
"<
logger
>
\
n
"
logger
=
self
.
check_simple_logger
(
"<
eventlog
>
\
n
"
" <logfile>
\
n
"
" path %s
\
n
"
" level debug
\
n
"
" </logfile>
\
n
"
"</
logger
>"
%
fn
)
"</
eventlog
>"
%
fn
)
# Make sure there's exactly one handler, since a warning gets
# printed if there are no handlers, and we don't want an
# unnecessary NullHandler getting added:
...
...
@@ -92,9 +92,9 @@ class TestzLOGConfig(unittest.TestCase):
def
check_simple_logger
(
self
,
text
,
level
=
logging
.
NOTSET
):
conf
=
self
.
get_config
(
text
)
self
.
assert
Equal
(
conf
.
logger
.
level
,
level
)
self
.
assert
_
(
conf
.
logger
is
not
None
)
logger
=
conf
.
logger
()
self
.
assert
_
(
conf
.
eventlog
is
not
None
)
self
.
assert
Equal
(
conf
.
eventlog
.
level
,
level
)
logger
=
conf
.
eventlog
()
self
.
assert_
(
isinstance
(
logger
,
logging
.
Logger
))
return
logger
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment