Addded README

Code cleanup
This commit is contained in:
Matias Fernandez
2019-09-11 22:00:39 -03:00
parent a6327060f9
commit aad1e08f6a
11 changed files with 476 additions and 216 deletions

View File

@@ -15,14 +15,41 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import inspect
import logging
logging.basicConfig(level=logging.DEBUG, format='[%(threadName)s] %(message)s')
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s: %(message)s')
logger = logging.getLogger('pyvncs')
def _log(*args, logtype='debug'):
def debug(*args):
str = ""
func = inspect.stack()[2][3]
if func[0] != '<':
func = "%s():" % func
_str = func
for s in args:
str = "%s %s" % (str, s)
str = str.strip()
logger.debug(str)
_str = "%s %s" % (_str, s)
_str = _str.strip()
f = getattr(logger, logtype)
#logger.debug(str)
f(_str)
def __getattr__(name):
def method(*args):
_str = ''
if args:
for s in args:
_str = "%s %s" % (_str, s)
_str = _str.strip()
_log(_str, logtype=name)
return method