Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
G
gracedb-client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
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
Tanner Prestegard
gracedb-client
Commits
8c0551e5
Commit
8c0551e5
authored
Jan 04, 2013
by
Brian Moe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporated Leo Singer's logging patch.
parent
009c9a3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
ligo/gracedb/logging.py
ligo/gracedb/logging.py
+25
-3
ligo/gracedb/test/test.py
ligo/gracedb/test/test.py
+2
-2
No files found.
ligo/gracedb/logg
er
.py
→
ligo/gracedb/logg
ing
.py
View file @
8c0551e5
# Copyright (C) 2012 LIGO Scientific Collaboration
#
# This program is free software; you can redistribute it and/or modify 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.
#
# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
"""
Some convenience logging classes courtesy of Leo Singer, provided as is.
Usage:
import logging
import ligo.gracedb.rest
import ligo.gracedb.logg
er
import ligo.gracedb.logg
ing
logging.basicConfig()
log = logging.getLogger('testing')
...
...
@@ -13,7 +30,7 @@ log = logging.getLogger('testing')
gracedb = ligo.gracedb.rest.GraceDb()
graceid = 'T62829'
log.addHandler(ligo.gracedb.logg
er
.GraceDbLogHandler(gracedb, graceid))
log.addHandler(ligo.gracedb.logg
ing
.GraceDbLogHandler(gracedb, graceid))
# The following will create a log entry on the gracedb server
# (if the log level permits)
...
...
@@ -21,7 +38,12 @@ log.addHandler(ligo.gracedb.logger.GraceDbLogHandler(gracedb, graceid))
log.warn("this is a warning")
"""
import
logging
# Perform explicit absolute import of Python standard library logging module.
# 'import logging' would not work here, because it would be interpreted as this
# module itself.
# module itself.g
logging
=
__import__
(
'logging'
,
level
=
0
)
class
GraceDbLogStream
(
object
):
def
__init__
(
self
,
gracedb
,
graceid
):
...
...
ligo/gracedb/test/test.py
View file @
8c0551e5
...
...
@@ -197,7 +197,7 @@ class TestGracedb(unittest.TestCase):
def
test_logger
(
self
):
import
logging
import
ligo.gracedb.rest
import
ligo.gracedb.logg
er
import
ligo.gracedb.logg
ing
logging
.
basicConfig
()
log
=
logging
.
getLogger
(
'testing'
)
...
...
@@ -206,7 +206,7 @@ class TestGracedb(unittest.TestCase):
#gracedb = ligo.gracedb.rest.GraceDb()
graceid
=
eventId
log
.
addHandler
(
ligo
.
gracedb
.
logg
er
.
GraceDbLogHandler
(
gracedb
,
graceid
))
log
.
addHandler
(
ligo
.
gracedb
.
logg
ing
.
GraceDbLogHandler
(
gracedb
,
graceid
))
message
=
"Message is {0}"
.
format
(
random
.
random
())
log
.
warn
(
message
)
...
...
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