Skip to content

Commit

Permalink
Merge pull request #188 from Chrezm/5.0.0-post3-dev
Browse files Browse the repository at this point in the history
5.0.0-post3
  • Loading branch information
Chrezm authored Dec 19, 2022
2 parents 568829d + 7a4788b commit 2ad06d3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,3 +888,8 @@
* Fixed games not asserting properties of player groups after mutator calls
* Fixed trials being internally initialized incorrectly, which prevented commands such as /nsd_accept and /nsd_reject from running properly
* Fixed players using clients that do not have a HIDE_CHARACTER argument in inbound IC messages (e.g. AO 2.10) occassionally failing to receive messages if they are in first person mode or not in forward sprites mode

## 221218a (5.0.0-post3)
* Server logs now include the hub of the player that triggered the log message
* Server logs now explicitly show when players change hubs
* Fixed adding periods to a clock while the time is unknown failing halfway through
6 changes: 5 additions & 1 deletion server/client_changearea.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,14 @@ def _do_change_area(
else:
populated_message = ''

in_new_hub = ''
if old_area.hub != area.hub:
in_new_hub = f' in new hub {area.hub.get_numerical_id()}'

client.send_ooc(f'Changed area to {area.name}.{populated_message}')
logger.log_server(f'[{client.get_char_name()}]Changed area from '
f'{old_area.name} ({old_area.id}) to '
f'{area.name} ({area.id}).', client)
f'{area.name} ({area.id}){in_new_hub}.', client)
found_something, ding_something = client.notify_change_area(
area, old_dname, ignore_bleeding=ignore_bleeding,
ignore_autopass=ignore_autopass)
Expand Down
20 changes: 11 additions & 9 deletions server/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,36 +235,38 @@ def log_error(msg: str, server: Union[TsuserverDR, None], errortype='P') -> str:
return file


def log_server(msg, client=None):
def log_server(msg: str, client: ClientManager.Client = None):
msg = f'{parse_client_info(client)}{msg}'
logging.getLogger('server').info(msg)


def log_print(msg, client=None):
def log_print(msg: str, client: ClientManager.Client = None):
msg = f'{parse_client_info(client)}{msg}'
current_time = Constants.get_time_iso()
print('{}: {}'.format(current_time, msg))


def log_pdebug(msg, client=None):
def log_pdebug(msg: str, client: ClientManager.Client = None):
log_debug(msg, client=client)
log_print(msg, client=client)


def log_pserver(msg, client=None):
def log_pserver(msg: str, client: ClientManager.Client = None):
log_server(msg, client=client)
log_print(msg, client=client)


def parse_client_info(client):
def parse_client_info(client: ClientManager.Client) -> str:
if client is None:
return ''
hdid = client.get_hdid()
ipid = client.get_ip()
if ipid is None:
info = None
ipid = 'None'
else:
info = '{:<15}'.format(ipid)
ipid = '{:<15}'.format(ipid)

output = f'[{ipid}][{hdid}][{client.id}][{client.hub.get_id()}]'
if client.is_mod:
return '[{}][{}][{}][MOD]'.format(info, hdid, client.id)
return '[{}][{}][{}]'.format(info, hdid, client.id)
output += '[MOD]'
return output
4 changes: 2 additions & 2 deletions server/task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,12 @@ def find_period_of_hour(hour) -> Tuple[int, str, int]:
# Case added a period
formatted_time = '{}:00'.format('{0:02d}'.format(start))
client.send_ooc(f'(X) You have added period `{name}`. '
f'Period hour length: {new_period_length} seconds. '
f'Period hour length: {current_period[2]} seconds. '
f'Period hour start: {formatted_time}.')
client.send_ooc_others(
f'(X) {client.displayname} [{client.id}] has added period `{name}` '
f'to their day cycle. '
f'Period hour length: {new_period_length} seconds. '
f'Period hour length: {current_period[2]} seconds. '
f'Period hour start: {formatted_time} '
f'({client.area.id}).',
is_zstaff_flex=True, in_hub=hub,
Expand Down
4 changes: 2 additions & 2 deletions server/tsuserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def __init__(self, client_manager_type: Type[ClientManager] = None):
self.release = 5
self.major_version = 0
self.minor_version = 0
self.segment_version = 'post2'
self.internal_version = '221208a'
self.segment_version = 'post3'
self.internal_version = '221218a'
version_string = self.get_version_string()
self.software = 'TsuserverDR {}'.format(version_string)
self.version = 'TsuserverDR {} ({})'.format(version_string, self.internal_version)
Expand Down

0 comments on commit 2ad06d3

Please sign in to comment.