Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
60c53413
Commit
60c53413
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
77eba1b4
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 @
60c53413
...
@@ -54,12 +54,12 @@ zeo_conf_template = """# ZEO configuration file
...
@@ -54,12 +54,12 @@ zeo_conf_template = """# ZEO configuration file
path %(home)s/var/Data.fs
path %(home)s/var/Data.fs
</filestorage>
</filestorage>
<
logger
>
<
eventlog
>
level info
level info
<logfile>
<logfile>
path %(home)s/log/zeo.log
path %(home)s/log/zeo.log
</logfile>
</logfile>
</
logger
>
</
eventlog
>
"""
"""
runner_conf_template
=
"""# runner configuration file
runner_conf_template
=
"""# runner configuration file
...
...
src/ZEO/runzeo.py
View file @
60c53413
...
@@ -93,7 +93,7 @@ class ZEOOptionsMixin:
...
@@ -93,7 +93,7 @@ class ZEOOptionsMixin:
class
ZEOOptions
(
ZDOptions
,
ZEOOptionsMixin
):
class
ZEOOptions
(
ZDOptions
,
ZEOOptionsMixin
):
logsectionname
=
"
logger
"
logsectionname
=
"
eventlog
"
def
__init__
(
self
):
def
__init__
(
self
):
self
.
schemadir
=
os
.
path
.
dirname
(
ZEO
.
__file__
)
self
.
schemadir
=
os
.
path
.
dirname
(
ZEO
.
__file__
)
...
...
src/ZEO/schema.xml
View file @
60c53413
...
@@ -27,6 +27,6 @@
...
@@ -27,6 +27,6 @@
</description>
</description>
</multisection>
</multisection>
<section
name=
"*"
type=
"
logger"
attribute=
"logger
"
required=
"no"
/>
<section
name=
"*"
type=
"
eventlog"
attribute=
"eventlog
"
required=
"no"
/>
</schema>
</schema>
src/zLOG/component.xml
View file @
60c53413
...
@@ -27,14 +27,14 @@
...
@@ -27,14 +27,14 @@
datatype=
".log_format"
/>
datatype=
".log_format"
/>
</sectiontype>
</sectiontype>
<sectiontype
name=
"
nt
eventlog"
datatype=
".nteventlog_handler"
<sectiontype
name=
"
win32-
eventlog"
datatype=
".nteventlog_handler"
implements=
"loghandler"
extends=
"base-log-handler"
>
implements=
"loghandler"
extends=
"base-log-handler"
>
<key
name=
"appname"
default=
"Zope"
/>
<key
name=
"appname"
default=
"Zope"
/>
<key
name=
"format"
default=
"%(message)s"
<key
name=
"format"
default=
"%(message)s"
datatype=
".log_format"
/>
datatype=
".log_format"
/>
</sectiontype>
</sectiontype>
<sectiontype
name=
"http
_handl
er"
datatype=
".http_handler"
<sectiontype
name=
"http
-logg
er"
datatype=
".http_handler"
implements=
"loghandler"
extends=
"base-log-handler"
>
implements=
"loghandler"
extends=
"base-log-handler"
>
<key
name=
"url"
default=
"localhost"
datatype=
".http_handler_url"
/>
<key
name=
"url"
default=
"localhost"
datatype=
".http_handler_url"
/>
<key
name=
"method"
default=
"GET"
datatype=
".get_or_post"
/>
<key
name=
"method"
default=
"GET"
datatype=
".get_or_post"
/>
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
datatype=
".log_format"
/>
datatype=
".log_format"
/>
</sectiontype>
</sectiontype>
<sectiontype
name=
"
smtp_handl
er"
datatype=
".smtp_handler"
<sectiontype
name=
"
email-notifi
er"
datatype=
".smtp_handler"
implements=
"loghandler"
extends=
"base-log-handler"
>
implements=
"loghandler"
extends=
"base-log-handler"
>
<key
name=
"fromaddr"
required=
"yes"
/>
<key
name=
"fromaddr"
required=
"yes"
/>
<multikey
name=
"toaddr"
required=
"yes"
attribute=
"toaddrs"
/>
<multikey
name=
"toaddr"
required=
"yes"
attribute=
"toaddrs"
/>
...
@@ -52,17 +52,8 @@
...
@@ -52,17 +52,8 @@
datatype=
".log_format"
/>
datatype=
".log_format"
/>
</sectiontype>
</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"
/>
<key
name=
"level"
datatype=
".logging_level"
default=
"all"
/>
<multisection
type=
"loghandler"
attribute=
"handlers"
name=
"*"
/>
<multisection
type=
"loghandler"
attribute=
"handlers"
name=
"*"
/>
</sectiontype>
</sectiontype>
...
...
src/zLOG/datatypes.py
View file @
60c53413
...
@@ -211,25 +211,10 @@ def smtp_handler(section):
...
@@ -211,25 +211,10 @@ def smtp_handler(section):
section
.
toaddrs
,
section
.
toaddrs
,
section
.
subject
)
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
=
[]
_marker
=
[]
class
LoggerWrapper
:
class
EventLogFactory
:
"""
"""
A wrapper used to create loggers while delaying actual logger
A wrapper used to create loggers while delaying actual logger
instance construction. We need to do this because we may
instance construction. We need to do this because we may
...
@@ -238,9 +223,9 @@ class LoggerWrapper:
...
@@ -238,9 +223,9 @@ class LoggerWrapper:
An instance of this wrapper is a callable which, when called, returns a
An instance of this wrapper is a callable which, when called, returns a
logger object.
logger object.
"""
"""
def
__init__
(
self
,
level
,
handler_factories
):
def
__init__
(
self
,
section
):
self
.
level
=
level
self
.
level
=
section
.
level
self
.
handler_factories
=
handler_factorie
s
self
.
handler_factories
=
section
.
handler
s
self
.
resolved
=
_marker
self
.
resolved
=
_marker
def
__call__
(
self
):
def
__call__
(
self
):
...
...
src/zLOG/tests/testzLogConfig.py
View file @
60c53413
...
@@ -31,7 +31,7 @@ class TestzLOGConfig(unittest.TestCase):
...
@@ -31,7 +31,7 @@ class TestzLOGConfig(unittest.TestCase):
_schematext
=
"""
_schematext
=
"""
<schema>
<schema>
<import package='zLOG'/>
<import package='zLOG'/>
<section type='
logger' name='*' attribute='logger
'/>
<section type='
eventlog' name='*' attribute='eventlog
'/>
</schema>
</schema>
"""
"""
...
@@ -62,10 +62,10 @@ class TestzLOGConfig(unittest.TestCase):
...
@@ -62,10 +62,10 @@ class TestzLOGConfig(unittest.TestCase):
def
test_config_without_logger
(
self
):
def
test_config_without_logger
(
self
):
conf
=
self
.
get_config
(
""
)
conf
=
self
.
get_config
(
""
)
self
.
assert_
(
conf
.
logger
is
None
)
self
.
assert_
(
conf
.
eventlog
is
None
)
def
test_config_without_handlers
(
self
):
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
# Make sure there's a NullHandler, since a warning gets
# printed if there are no handlers:
# printed if there are no handlers:
self
.
assertEqual
(
len
(
logger
.
handlers
),
1
)
self
.
assertEqual
(
len
(
logger
.
handlers
),
1
)
...
@@ -74,12 +74,12 @@ class TestzLOGConfig(unittest.TestCase):
...
@@ -74,12 +74,12 @@ class TestzLOGConfig(unittest.TestCase):
def
test_with_logfile
(
self
):
def
test_with_logfile
(
self
):
fn
=
tempfile
.
mktemp
()
fn
=
tempfile
.
mktemp
()
logger
=
self
.
check_simple_logger
(
"<
logger
>
\
n
"
logger
=
self
.
check_simple_logger
(
"<
eventlog
>
\
n
"
" <logfile>
\
n
"
" <logfile>
\
n
"
" path %s
\
n
"
" path %s
\
n
"
" level debug
\
n
"
" level debug
\
n
"
" </logfile>
\
n
"
" </logfile>
\
n
"
"</
logger
>"
%
fn
)
"</
eventlog
>"
%
fn
)
# Make sure there's exactly one handler, since a warning gets
# Make sure there's exactly one handler, since a warning gets
# printed if there are no handlers, and we don't want an
# printed if there are no handlers, and we don't want an
# unnecessary NullHandler getting added:
# unnecessary NullHandler getting added:
...
@@ -92,9 +92,9 @@ class TestzLOGConfig(unittest.TestCase):
...
@@ -92,9 +92,9 @@ class TestzLOGConfig(unittest.TestCase):
def
check_simple_logger
(
self
,
text
,
level
=
logging
.
NOTSET
):
def
check_simple_logger
(
self
,
text
,
level
=
logging
.
NOTSET
):
conf
=
self
.
get_config
(
text
)
conf
=
self
.
get_config
(
text
)
self
.
assert
Equal
(
conf
.
logger
.
level
,
level
)
self
.
assert
_
(
conf
.
eventlog
is
not
None
)
self
.
assert
_
(
conf
.
logger
is
not
None
)
self
.
assert
Equal
(
conf
.
eventlog
.
level
,
level
)
logger
=
conf
.
logger
()
logger
=
conf
.
eventlog
()
self
.
assert_
(
isinstance
(
logger
,
logging
.
Logger
))
self
.
assert_
(
isinstance
(
logger
,
logging
.
Logger
))
return
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