Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
62401262
Commit
62401262
authored
Apr 25, 2000
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved ZLogger to lib/python
parent
550a9682
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1 addition
and
467 deletions
+1
-467
lib/python/Zope/ZLogger/FileLogger.py
lib/python/Zope/ZLogger/FileLogger.py
+0
-13
lib/python/Zope/ZLogger/ZLogger.py
lib/python/Zope/ZLogger/ZLogger.py
+0
-18
lib/python/Zope/ZLogger/__init__.py
lib/python/Zope/ZLogger/__init__.py
+0
-86
lib/python/Zope/ZLogger/stupidFileLogger.py
lib/python/Zope/ZLogger/stupidFileLogger.py
+0
-149
lib/python/Zope/ZLogger/syslog.py
lib/python/Zope/ZLogger/syslog.py
+0
-180
lib/python/Zope/ZLogger/syslogLogger.py
lib/python/Zope/ZLogger/syslogLogger.py
+0
-20
z2.py
z2.py
+1
-1
No files found.
lib/python/Zope/ZLogger/FileLogger.py
deleted
100644 → 0
View file @
550a9682
class
FileLogger
:
""" a File Logger
This is just a stub, FileLogger should be smarter than
stupidFileLogger, but for the moment it's completely brain dead.
"""
def
__init__
(
self
):
pass
def
__call__
(
self
,
sub
,
sev
,
sum
,
det
,
err
):
print
'syslogger %s, %s, %s, %s, %s, %s'
%
(
self
,
sub
,
sev
,
sum
,
det
,
err
)
lib/python/Zope/ZLogger/ZLogger.py
deleted
100644 → 0
View file @
550a9682
import
stupidFileLogger
import
syslogLogger
from
zLOG
import
*
loggers
=
(
stupidFileLogger
.
stupidFileLogger
(),
syslogLogger
.
syslogLogger
(),)
def
log_write
(
subsystem
,
severity
,
summary
,
detail
,
error
):
""" Hook into the logging system
The actual logic to determine what log messages go where will go
here. For now, everything goes to all loggers.
"""
if
severity
<
0
:
return
for
logger
in
loggers
:
logger
(
subsystem
,
severity
,
summary
,
detail
,
error
)
lib/python/Zope/ZLogger/__init__.py
deleted
100644 → 0
View file @
550a9682
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
import
ZLogger
lib/python/Zope/ZLogger/stupidFileLogger.py
deleted
100644 → 0
View file @
550a9682
import
time
,
sys
,
string
,
os
_stupid_dest
=
None
_no_stupid_log
=
[]
format_exception_only
=
None
# Standard severities
BLATHER
=-
100
INFO
=
0
PROBLEM
=
WARNING
=
100
ERROR
=
200
PANIC
=
300
def
severity_string
(
severity
,
mapping
=
{
-
100
:
'BLATHER'
,
0
:
'INFO'
,
100
:
'PROBLEM'
,
200
:
'ERROR'
,
300
:
'PANIC'
,
}):
"""Convert a severity code to a string
"""
s
=
int
(
severity
)
if
mapping
.
has_key
(
s
):
s
=
mapping
[
s
]
else
:
s
=
''
return
"%s(%s)"
%
(
s
,
severity
)
class
stupidFileLogger
:
""" a stupid File Logger """
def
__init__
(
self
):
pass
def
__call__
(
self
,
sub
,
sev
,
sum
,
det
,
err
):
stupid_log_write
(
sub
,
sev
,
sum
,
det
,
err
)
def
stupid_log_write
(
subsystem
,
severity
,
summary
,
detail
,
error
):
if
severity
<
0
:
return
global
_stupid_dest
if
_stupid_dest
is
None
:
import
os
if
os
.
environ
.
has_key
(
'STUPID_LOG_FILE'
):
f
=
os
.
environ
[
'STUPID_LOG_FILE'
]
if
f
:
_stupid_dest
=
open
(
f
,
'a'
)
else
:
import
sys
_stupid_dest
=
sys
.
stderr
else
:
_stupid_dest
=
_no_stupid_log
import
os
if
os
.
environ
.
has_key
(
'Z_DEBUG_MODE'
):
import
sys
sys
.
stderr
.
write
(
"------
\
n
"
"%s %s %s %s
\
n
%s"
%
(
log_time
(),
severity_string
(
severity
),
subsystem
,
summary
,
detail
,
)
)
sys
.
stderr
.
flush
()
if
_stupid_dest
is
_no_stupid_log
:
return
_stupid_dest
.
write
(
"------
\
n
"
"%s %s %s %s
\
n
%s"
%
(
log_time
(),
severity_string
(
severity
),
subsystem
,
summary
,
detail
,
)
)
_stupid_dest
.
flush
()
if
error
:
try
:
_stupid_dest
.
write
(
format_exception
(
error
[
0
],
error
[
1
],
error
[
2
],
trailer
=
'
\
n
'
,
limit
=
100
))
except
:
_stupid_dest
.
write
(
"%s: %s
\
n
"
%
error
[:
2
])
def
format_exception
(
etype
,
value
,
tb
,
limit
=
None
,
delimiter
=
'
\
n
'
,
header
=
''
,
trailer
=
''
):
global
format_exception_only
if
format_exception_only
is
None
:
import
traceback
format_exception_only
=
traceback
.
format_exception_only
result
=
[
'Traceback (innermost last):'
]
if
header
:
result
.
insert
(
0
,
header
)
if
limit
is
None
:
if
hasattr
(
sys
,
'tracebacklimit'
):
limit
=
sys
.
tracebacklimit
n
=
0
while
tb
is
not
None
and
(
limit
is
None
or
n
<
limit
):
f
=
tb
.
tb_frame
lineno
=
tb
.
tb_lineno
co
=
f
.
f_code
filename
=
co
.
co_filename
name
=
co
.
co_name
locals
=
f
.
f_locals
result
.
append
(
' File %s, line %d, in %s'
%
(
filename
,
lineno
,
name
))
try
:
result
.
append
(
' (Object: %s)'
%
locals
[
co
.
co_varnames
[
0
]].
__name__
)
except
:
pass
try
:
result
.
append
(
' (Info: %s)'
%
str
(
locals
[
'__traceback_info__'
]))
except
:
pass
tb
=
tb
.
tb_next
n
=
n
+
1
result
.
append
(
string
.
join
(
format_exception_only
(
etype
,
value
),
' '
))
if
trailer
:
result
.
append
(
trailer
)
return
string
.
join
(
result
,
delimiter
)
def
log_time
():
"""Return a simple time string without spaces suitable for logging
"""
return
(
"%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d"
%
time
.
gmtime
(
time
.
time
())[:
6
])
lib/python/Zope/ZLogger/syslog.py
deleted
100644 → 0
View file @
550a9682
# -*- Mode: Python; tab-width: 4 -*-
# From: "Samual M. Rushing" <rushing@nightmare.com>
# Date: Mon, 21 Apr 1997 16:10:42 -0500
# ======================================================================
# Copyright 1997 by Sam Rushing
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of Sam
# Rushing not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
# SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
# NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# ======================================================================
"""socket interface to unix syslog.
On Unix, there are usually two ways of getting to syslog: via a
local unix-domain socket, or via the TCP service.
Usually "/dev/log" is the unix domain socket. This may be different
for other systems.
>>> my_client = syslog_client ('/dev/log')
Otherwise, just use the UDP version, port 514.
>>> my_client = syslog_client (('my_log_host', 514))
On win32, you will have to use the UDP version. Note that
you can use this to log to other hosts (and indeed, multiple
hosts).
This module is not a drop-in replacement for the python
<syslog> extension module - the interface is different.
Usage:
>>> c = syslog_client()
>>> c = syslog_client ('/strange/non_standard_log_location')
>>> c = syslog_client (('other_host.com', 514))
>>> c.log ('testing', facility='local0', priority='debug')
"""
# TODO: support named-pipe syslog.
# [see ftp://sunsite.unc.edu/pub/Linux/system/Daemons/syslog-fifo.tar.z]
# from <linux/sys/syslog.h>:
# ===========================================================================
# priorities/facilities are encoded into a single 32-bit quantity, where the
# bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
# (0-big number). Both the priorities and the facilities map roughly
# one-to-one to strings in the syslogd(8) source code. This mapping is
# included in this file.
#
# priorities (these are ordered)
LOG_EMERG
=
0
# system is unusable
LOG_ALERT
=
1
# action must be taken immediately
LOG_CRIT
=
2
# critical conditions
LOG_ERR
=
3
# error conditions
LOG_WARNING
=
4
# warning conditions
LOG_NOTICE
=
5
# normal but significant condition
LOG_INFO
=
6
# informational
LOG_DEBUG
=
7
# debug-level messages
# facility codes
LOG_KERN
=
0
# kernel messages
LOG_USER
=
1
# random user-level messages
LOG_MAIL
=
2
# mail system
LOG_DAEMON
=
3
# system daemons
LOG_AUTH
=
4
# security/authorization messages
LOG_SYSLOG
=
5
# messages generated internally by syslogd
LOG_LPR
=
6
# line printer subsystem
LOG_NEWS
=
7
# network news subsystem
LOG_UUCP
=
8
# UUCP subsystem
LOG_CRON
=
9
# clock daemon
LOG_AUTHPRIV
=
10
# security/authorization messages (private)
# other codes through 15 reserved for system use
LOG_LOCAL0
=
16
# reserved for local use
LOG_LOCAL1
=
17
# reserved for local use
LOG_LOCAL2
=
18
# reserved for local use
LOG_LOCAL3
=
19
# reserved for local use
LOG_LOCAL4
=
20
# reserved for local use
LOG_LOCAL5
=
21
# reserved for local use
LOG_LOCAL6
=
22
# reserved for local use
LOG_LOCAL7
=
23
# reserved for local use
priority_names
=
{
"alert"
:
LOG_ALERT
,
"crit"
:
LOG_CRIT
,
"debug"
:
LOG_DEBUG
,
"emerg"
:
LOG_EMERG
,
"err"
:
LOG_ERR
,
"error"
:
LOG_ERR
,
# DEPRECATED
"info"
:
LOG_INFO
,
"notice"
:
LOG_NOTICE
,
"panic"
:
LOG_EMERG
,
# DEPRECATED
"warn"
:
LOG_WARNING
,
# DEPRECATED
"warning"
:
LOG_WARNING
,
}
facility_names
=
{
"auth"
:
LOG_AUTH
,
"authpriv"
:
LOG_AUTHPRIV
,
"cron"
:
LOG_CRON
,
"daemon"
:
LOG_DAEMON
,
"kern"
:
LOG_KERN
,
"lpr"
:
LOG_LPR
,
"mail"
:
LOG_MAIL
,
"news"
:
LOG_NEWS
,
"security"
:
LOG_AUTH
,
# DEPRECATED
"syslog"
:
LOG_SYSLOG
,
"user"
:
LOG_USER
,
"uucp"
:
LOG_UUCP
,
"local0"
:
LOG_LOCAL0
,
"local1"
:
LOG_LOCAL1
,
"local2"
:
LOG_LOCAL2
,
"local3"
:
LOG_LOCAL3
,
"local4"
:
LOG_LOCAL4
,
"local5"
:
LOG_LOCAL5
,
"local6"
:
LOG_LOCAL6
,
"local7"
:
LOG_LOCAL7
,
}
import
socket
class
syslog_client
:
def
__init__
(
self
,
address
=
'/dev/log'
):
self
.
address
=
address
if
type
(
address
)
==
type
(
''
):
self
.
socket
=
socket
.
socket
(
socket
.
AF_UNIX
,
socket
.
SOCK_STREAM
)
self
.
socket
.
connect
(
address
)
self
.
unix
=
1
else
:
self
.
socket
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
self
.
unix
=
0
# curious: when talking to the unix-domain '/dev/log' socket, a
# zero-terminator seems to be required. this string is placed
# into a class variable so that it can be overridden if
# necessary.
log_format_string
=
'<%d>%s
\
000
'
def
log
(
self
,
message
,
facility
=
LOG_USER
,
priority
=
LOG_INFO
):
message
=
self
.
log_format_string
%
(
self
.
encode_priority
(
facility
,
priority
),
message
)
if
self
.
unix
:
self
.
socket
.
send
(
message
)
else
:
self
.
socket
.
sendto
(
message
,
self
.
address
)
def
encode_priority
(
self
,
facility
,
priority
):
if
type
(
facility
)
==
type
(
''
):
facility
=
facility_names
[
facility
]
if
type
(
priority
)
==
type
(
''
):
priority
=
priority_names
[
priority
]
return
(
facility
<<
3
)
|
priority
def
close
(
self
):
if
self
.
unix
:
self
.
socket
.
close
()
lib/python/Zope/ZLogger/syslogLogger.py
deleted
100644 → 0
View file @
550a9682
from
syslog
import
syslog_client
import
os
,
string
class
syslogLogger
:
""" a syslog Logger """
def
__init__
(
self
):
if
os
.
environ
.
has_key
(
'ZSYSLOG_SERVER'
):
(
addr
,
port
)
=
string
.
split
(
os
.
environ
[
'ZSYSLOG_SERVER'
],
':'
)
self
.
client
=
syslog_client
((
addr
,
int
(
port
)))
self
.
on
=
1
elif
os
.
environ
.
has_key
(
'ZSYSLOG'
):
self
.
client
=
syslog_client
()
self
.
on
=
1
else
:
self
.
on
=
0
def
__call__
(
self
,
sub
,
sev
,
sum
,
det
,
err
):
if
self
.
on
:
self
.
client
.
log
(
sum
)
z2.py
View file @
62401262
...
...
@@ -512,7 +512,7 @@ exec "import "+MODULE in {}
import
zLOG
from
Zope
import
ZLogger
import
ZLogger
if
READ_ONLY
:
zLOG
.
_stupid_dest
=
sys
.
stderr
...
...
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