Add pypiezo.LOG to allow easy logging.
authorW. Trevor King <wking@drexel.edu>
Thu, 10 Mar 2011 13:59:52 +0000 (08:59 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 10 Mar 2011 13:59:52 +0000 (08:59 -0500)
pypiezo/__init__.py

index 3d079a0ece405a4088160e9c30ddc9b9349a2d52..38b75afda561e55ca1626bb150ba039c6af4b0d1 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with pypiezo.  If not, see <http://www.gnu.org/licenses/>.
 
+import logging as _logging
+
+
 __version__ = '0.4'
+
+
+LOG = _logging.getLogger('pypiezo')
+"Pypiezo logger"
+
+LOG.setLevel(_logging.DEBUG)
+h = _logging.StreamHandler()
+#h.setLevel(_logging.WARN)
+h.setLevel(_logging.DEBUG)
+f = _logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
+h.setFormatter(f)
+LOG.addHandler(h)
+del h, f