From 36d57ca156ea6146f4a66bf65134a8349d9c5e3c Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 17 May 2013 11:19:50 +0800 Subject: [PATCH 1/2] add logging in python snippets --- snippets/python.snippets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index 9cb2113..5f719df 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -162,3 +162,18 @@ snippet getopt ${4} elif option in ("-v", "--verbose"): verbose = argument +# logging +# glog = get log +snippet glog + import logging + logger = logging.getLogger(${2:__name__}) +snippet le + logger.error(${1:msg}) +snippet ld + logger.debug(${1:msg}) +snippet lw + logger.warning(${1:msg}) +snippet lc + logger.critical(${1:msg}) +snippet li + logger.info(${1:msg}) From aabd2d94ca3995cde8217c6b8896066d1488ac6a Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 17 May 2013 11:28:28 +0800 Subject: [PATCH 2/2] fix glog $2 not right --- snippets/python.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/python.snippets b/snippets/python.snippets index 5f719df..ed1155f 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -166,7 +166,7 @@ snippet getopt # glog = get log snippet glog import logging - logger = logging.getLogger(${2:__name__}) + logger = logging.getLogger(${1:__name__}) snippet le logger.error(${1:msg}) snippet ld