[issue45351] List all sockets in TCP echo server using streams

2021-10-03 Thread Olaf van der Spek


New submission from Olaf van der Spek :

Replace:
addr = server.sockets[0].getsockname()
print(f'Serving on {addr}')

By:
for socket in server.sockets: 
  addr = socket.getsockname()
  print(f'Serving on {addr}')

https://docs.python.org/3/library/asyncio-stream.html

--
assignee: docs@python
components: Documentation
messages: 403084
nosy: docs@python, olafvdspek
priority: normal
severity: normal
status: open
title: List all sockets in TCP echo server using streams

___
Python tracker 
<https://bugs.python.org/issue45351>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45351] List all sockets in TCP echo server using streams

2021-10-08 Thread Olaf van der Spek


Olaf van der Spek  added the comment:

> server = await asyncio.start_server(handle_echo, '127.0.0.1', )

If 127.0.0.1 is replaced by localhost, the server might listen on ::1 and 
127.0.0.1 but only one address will be printed, which is confusing (and wrong 
IMO).

So the output of the example isn't wrong if you don't change it, but the 
example code itself could be better.

--

___
Python tracker 
<https://bugs.python.org/issue45351>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45682] Nicer default logging format

2021-10-31 Thread Olaf van der Spek


New submission from Olaf van der Spek :

The default logging format will print something like: 
WARNING:root:Hello Python!

Could it default to something like this instead?

2021-10-31 14:52:36,490 WARNING: Hello Python!

logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s')
logging.warning('Hello Python!')

--
components: Library (Lib)
messages: 405403
nosy: olafvdspek
priority: normal
severity: normal
status: open
title: Nicer default logging format
type: enhancement

___
Python tracker 
<https://bugs.python.org/issue45682>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45682] Nicer default logging format

2021-10-31 Thread Olaf van der Spek


Olaf van der Spek  added the comment:

> Except that people may have used the current basic format in, for example, 
> unit tests, and that code could break after a change like the one proposed.

They too could pass a format argument themselves rather then relying on the 
default format never changing.

--

___
Python tracker 
<https://bugs.python.org/issue45682>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com