Change print to logger functions and provide context

This commit is contained in:
Arinerron 2019-03-29 17:21:02 -07:00
parent ef93910f98
commit 957f250665
No known key found for this signature in database
GPG Key ID: 99383627861C62F0
4 changed files with 7 additions and 7 deletions

View File

@ -123,7 +123,7 @@ class Onionr:
config.set('client.client.port', randomPort, savefile=True)
if type(config.get('client.public.port')) is type(None):
randomPort = netcontroller.getOpenPort()
print(randomPort)
logger.debug('Random port chosen: %s' % randomPort)
config.set('client.public.port', randomPort, savefile=True)
if type(config.get('client.participate')) is type(None):
config.set('client.participate', True, savefile=True)

View File

@ -46,7 +46,7 @@ def open_home(o_inst):
logger.error('Onionr seems to not be running (could not get api host)')
else:
url = 'http://%s/#%s' % (url, o_inst.onionrCore.config.get('client.webpassword'))
print('If Onionr does not open automatically, use this URL:', url)
logger.info('If Onionr does not open automatically, use this URL:\n\n%s' % url)
webbrowser.open_new_tab(url)
def get_commands(onionr_inst):

View File

@ -104,7 +104,7 @@ def show_peers(o_inst):
if not type(peers) is None:
if peers not in ('', 'failure', None):
if peers != False:
print(peers)
logger.info('Peers: %s' % peers)
else:
print('Daemon probably not running. Unable to list connected peers.')
break
logger.warn('Daemon probably not running. Unable to list connected peers.')
break

View File

@ -82,12 +82,12 @@ class OnionrCLIUI:
if self.flow_enabled:
self.subCommand("flow")
else:
print('Plugin not enabled')
logger.warn('flow plugin is not enabled')
elif choice in ("2", "mail"):
if self.mail_enabled:
self.subCommand("mail")
else:
print('Plugin not enabled')
logger.warn('mail plugin not enabled')
elif choice in ("3", "file sharing", "file"):
filename = input("Enter full path to file: ").strip()
self.subCommand("addfile", filename)