Skip to content

Commit 08e0dc2

Browse files
committed
Make examples' output quiet by default
1 parent d162e54 commit 08e0dc2

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

examples/browser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import logging
77
import socket
8+
import sys
89
from time import sleep
910

1011
from zeroconf import ServiceBrowser, ServiceStateChange, Zeroconf
@@ -31,7 +32,9 @@ def on_service_state_change(zeroconf, service_type, name, state_change):
3132

3233
if __name__ == '__main__':
3334
logging.basicConfig(level=logging.DEBUG)
34-
logging.getLogger('zeroconf').setLevel(logging.DEBUG)
35+
if len(sys.argv) > 1:
36+
assert sys.argv[1:] == ['--debug']
37+
logging.getLogger('zeroconf').setLevel(logging.DEBUG)
3538

3639
zeroconf = Zeroconf()
3740
print("\nBrowsing services, press Ctrl-C to exit...\n")

examples/registration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44

55
import logging
66
import socket
7+
import sys
78
from time import sleep
89

910
from zeroconf import ServiceInfo, Zeroconf
1011

1112
if __name__ == '__main__':
1213
logging.basicConfig(level=logging.DEBUG)
13-
logging.getLogger('zeroconf').setLevel(logging.DEBUG)
14+
if len(sys.argv) > 1:
15+
assert sys.argv[1:] == ['--debug']
16+
logging.getLogger('zeroconf').setLevel(logging.DEBUG)
1417

1518
desc = {'path': '/~paulsm/'}
1619

0 commit comments

Comments
 (0)