to demo utf8, emoji logging without exception #1093

Closed
sigoa wants to merge 2 commits from patch-2 into master

View File

@ -1,4 +1,5 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2016 Jonathan Warren
# Copyright (c) 2012-2016 The Bitmessage developers # Copyright (c) 2012-2016 The Bitmessage developers
# Distributed under the MIT/X11 software license. See the accompanying # Distributed under the MIT/X11 software license. See the accompanying
@ -406,10 +407,27 @@ All parameters are optional.
return {'address':address,'port':port} return {'address':address,'port':port}
def LoggWithUnicode():
from debug import logger
#reload(sys)
#sys.setdefaultencoding( 'utf8')
logger.info(str( u'logger encoding reset '.encode("UTF-8") ))
#logger.info('unicode as log output possible: 🤷 ')
#logger.info( ' äüß 🤷 🤷 🤷 -- just a test emoji info to demo the function LoggWithUnicode() , no exception raised ')
# note that .info lines are invisible under standard logging settings, unlike a .warning log
# uncomment for demo
# call function #LoggWithUnicode() # to demo/test utf8 / Unicode logging without exception
def main(): def main():
mainprogram = Main() mainprogram = Main()
mainprogram.start() mainprogram.start()
reload(sys)
sys.setdefaultencoding('utf8')
if __name__ == "__main__": if __name__ == "__main__":
main() main()