Files
Hippolyzer/hippolyzer/lib/base/settings.py

100 lines
3.4 KiB
Python
Raw Normal View History

"""
Copyright 2009, Linden Research, Inc.
2021-04-30 17:30:24 +00:00
See NOTICE.md for previous contributors
Copyright 2021, Salad Dais
All Rights Reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
"""
2021-04-30 17:30:24 +00:00
class Settings:
def __init__(self, quiet_logging=False, spammy_logging=False, log_tests=True):
""" some lovely configurable settings
These are applied application wide, and can be
overridden at any time in a specific instance
2009-09-04 03:56:29 +00:00
quiet_logging overrides spammy_logging
"""
self.quiet_logging = quiet_logging
2009-09-04 03:56:29 +00:00
self.spammy_logging = spammy_logging
# toggle handling udp packets
self.HANDLE_PACKETS = True
self.HANDLE_OUTGOING_PACKETS = False
# toggle parsing all/handled packets
self.ENABLE_DEFERRED_PACKET_PARSING = True
2021-04-30 17:30:24 +00:00
# ~~~~~~~~~~~~~~~~~~
2009-02-06 00:29:40 +00:00
# Logging behaviors
2021-04-30 17:30:24 +00:00
# ~~~~~~~~~~~~~~~~~~
# being a test tool, and an immature one at that,
# enable fine granularity in the logging, but
# make sure we can tone it down as well
self.LOG_VERBOSE = True
2009-09-04 03:56:29 +00:00
self.ENABLE_BYTES_TO_HEX_LOGGING = False
self.ENABLE_CAPS_LOGGING = True
2009-09-04 03:56:29 +00:00
self.ENABLE_CAPS_LLSD_LOGGING = False
self.ENABLE_EQ_LOGGING = True
self.ENABLE_UDP_LOGGING = True
self.ENABLE_OBJECT_LOGGING = True
self.LOG_SKIPPED_PACKETS = True
self.ENABLE_HOST_LOGGING = True
self.LOG_COROUTINE_SPAWNS = True
self.PROXY_LOGGING = False
# allow disabling logging of certain packets
self.DISABLE_SPAMMERS = True
self.UDP_SPAMMERS = ['PacketAck', 'AgentUpdate']
2010-03-09 15:36:49 -08:00
# toggle handling a region's event queue
2021-04-30 17:30:24 +00:00
self.ENABLE_REGION_EVENT_QUEUE = True
2010-03-09 15:36:49 -08:00
# how many seconds to wait between polling
# a region's event queue
self.REGION_EVENT_QUEUE_POLL_INTERVAL = 1
2021-04-30 17:30:24 +00:00
2009-09-04 03:56:29 +00:00
if self.spammy_logging:
self.ENABLE_BYTES_TO_HEX_LOGGING = True
self.ENABLE_CAPS_LLSD_LOGGING = True
self.DISABLE_SPAMMERS = False
# override the defaults
if self.quiet_logging:
self.LOG_VERBOSE = False
self.ENABLE_BYTES_TO_HEX_LOGGING = False
self.ENABLE_CAPS_LOGGING = False
self.ENABLE_CAPS_LLSD_LOGGING = False
self.ENABLE_EQ_LOGGING = False
self.ENABLE_UDP_LOGGING = False
self.LOG_SKIPPED_PACKETS = False
self.ENABLE_OBJECT_LOGGING = False
self.ENABLE_HOST_LOGGING = False
self.LOG_COROUTINE_SPAWNS = False
2009-09-04 03:56:29 +00:00
self.DISABLE_SPAMMERS = True
2021-04-30 17:30:24 +00:00
# ~~~~~~~~~~~~~~~~~~~~~~
# Test related settings
2021-04-30 17:30:24 +00:00
# ~~~~~~~~~~~~~~~~~~~~~~
2009-09-04 03:56:29 +00:00
if log_tests:
self.ENABLE_LOGGING_IN_TESTS = True
else:
self.ENABLE_LOGGING_IN_TESTS = False