title: Python logging module encrypt
body: <p>I've got a python script with logging. Now I want to encrypt log with AES using pycrypto. </p>
  
  <pre><code>import logging
  import base64
  from Crypto.Cipher import AES
  aes = AES.new(cryptoKey)
  logging.basicConfig(filename='example.log',level=logging.DEBUG) #  file name, not custom file
  logging.info('text')
  </code></pre>
  
  <p>I want to use <code>base64.b64encode(aes.encrypt('#logging text#'))</code> before write it to log . What is a most estate way to do it?</p>