Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8392306
journal_client.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
journal_client.py
View Options
# Copyright (C) 2018 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import
logging
from
swh.journal.client
import
JournalClient
class
JournalClientLogger
(
JournalClient
):
"""Client in charge of listing new received origins and origin_visits
in the swh journal.
"""
CONFIG_BASE_FILENAME
=
'journal/logger'
def
__init__
(
self
):
# Only interested in content here so override the configuration
super
()
.
__init__
(
extra_configuration
=
{
'object_types'
:
[
'origin'
,
'origin_visit'
]})
def
process_objects
(
self
,
messages
):
"""Simply log messages received.
"""
for
msg
in
messages
:
logging
.
info
(
'msg:
%s
'
%
msg
)
if
__name__
==
'__main__'
:
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
'
%(asctime)s
%(process)d
%(levelname)s
%(message)s
'
)
import
click
@click.command
()
def
main
():
"""Log the new received origin and origin_visits.
"""
JournalClientLogger
()
.
process
()
main
()
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Jun 4 2025, 6:57 PM (10 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3238633
Attached To
rDSNIP Code snippets
Event Timeline
Log In to Comment