# Path: gmeutils/child.py
# class _gmechild:
# 	"base class of all classes that will be used from class gme"
# 
# 	#########
# 	#__init__
# 	#########
# 
# 	def __init__(self,parent,filename):
# 		self.parent=parent
# 		self._level=1
# 		self.filename=filename
# 
# 	####
# 	#log
# 	####
# 
# 	def log(self,
# 			msg,
# 			infotype="m",
# 			lineno=-1,
# 			filename="",
# 			force=False):
# 
# 		if filename=="":
# 			filename=self.filename
# 
# 		try:
# 			self.parent._logger._level+=self._level
# 			self.parent.log(	msg=msg,
# 								infotype=infotype,
# 								lineno=lineno,
# 								filename=filename,
# 								force=force)
# 			self.parent._logger._level-=self._level
# 		except:
# 			sys.stderr.write("%s\n"%(msg))
# 
# 	##############
# 	#log_traceback
# 	##############
# 
# 	def log_traceback(self):
# 
# 		try:
# 			self.parent.log_traceback()
# 		except:
# 			pass
# 
# 
# 	######
# 	#error
# 	######
# 
# 	def error(	self,
# 				msg,
# 				lineno=0,
# 				filename=""):
# 		"""logs as error message. When logging is disabled,
# 		this will log to stderr"""
# 		self.log(msg,infotype="e",lineno=lineno,filename=filename,force=True)
# 
# 	########
# 	#warning
# 	########
# 
# 	def warning(self,
# 				msg,
# 				lineno=0,
# 				filename=""):
# 		"""logs as warning message."""
# 		self.log(msg,infotype="w",lineno=lineno,filename=filename,force=False)
# 
# 	######
# 	#debug
# 	######
# 
# 	def debug(  self,
# 				msg,
# 				lineno=0,
# 				filename=""):
# 
# 		if filename=="":
# 			filename=self.filename
# 
# 		try:
# 			self.parent._logger._level+=self._level
# 			self.parent.debug(msg=msg,lineno=lineno,filename=filename)
# 			self.parent._logger._level-=self._level
# 		except:
# 			pass
# 
# Path: gmeutils/_dbg.py
# def _dbg(func):
# 
# 	@wraps(func)
# 	def wrapper(*args, **kwargs):
# 		parent=None
# 
# 		lineno=0
# 		endlineno=0
# 		filename=inspect.getfile(func)
# 
# 		if args:
# 
# 			if isinstance(args[0],child._gmechild):
# 				parent=args[0]
# 			elif hasattr(args[0],"send_mails"):
# 				parent=args[0]
# 			elif hasattr(args[0],"parent"):
# 				parent=args[0].parent
# 
# 		if not parent:
# 			print(">> START %s"%func.__name__,lineno)
# 			result=func(*args,**kwargs)
# 			print(">> END %s"%func.__name__,lineno)
# 			return result
# 
# 
# 		try:
# 			source=inspect.getsourcelines(func)
# 			lineno=source[1]
# 			endlineno=lineno+len(source[0])
# 		except:
# 			pass
# 
# 		if (hasattr(parent,"_logger") and 
# 			hasattr(parent._logger,"_level")):
# 			parent._logger._level+=1
# 
# 		parent.debug("START %s"%func.__name__,lineno,filename)
# 		result=func(*args,**kwargs)
# 		parent.debug("END %s"%func.__name__,endlineno,filename)
# 
# 		if (hasattr(parent,"_logger") and 
# 			hasattr(parent._logger,"_level")):
# 			parent._logger._level-=1
# 
# 			if parent._logger._level<0:
# 				parent._logger._level=0
# 
# 		return result
# 
# 	return wrapper


import os
import inspect
import time
import sys
	import logging
	import logging.handlers
	import syslog
from .child 			import _gmechild
from .version 			import *
from   ._dbg 			import _dbg
from   gmeutils.helpers			import *
#License GPL v3
#Author Horst Knorr <gpgmailencrypt@gmx.de>


if os.name=="nt":
else:

LOG_DEBUG=1
LOG_INFO=2
LOG_WARNING=3
LOG_ERR=4

################
# CLASS mylogger
################


# Path: gmeutils/child.py
# class _gmechild:
# 	"base class of all classes that will be used from class gme"
# 
# 	#########
# 	#__init__
# 	#########
# 
# 	def __init__(self,parent,filename):
# 		self.parent=parent
# 		self._level=1
# 		self.filename=filename
# 
# 	####
# 	#log
# 	####
# 
# 	def log(self,
# 			msg,
# 			infotype="m",
# 			lineno=-1,
# 			filename="",
# 			force=False):
# 
# 		if filename=="":
# 			filename=self.filename
# 
# 		try:
# 			self.parent._logger._level+=self._level
# 			self.parent.log(	msg=msg,
# 								infotype=infotype,
# 								lineno=lineno,
# 								filename=filename,
# 								force=force)
# 			self.parent._logger._level-=self._level
# 		except:
# 			sys.stderr.write("%s\n"%(msg))
# 
# 	##############
# 	#log_traceback
# 	##############
# 
# 	def log_traceback(self):
# 
# 		try:
# 			self.parent.log_traceback()
# 		except:
# 			pass
# 
# 
# 	######
# 	#error
# 	######
# 
# 	def error(	self,
# 				msg,
# 				lineno=0,
# 				filename=""):
# 		"""logs as error message. When logging is disabled,
# 		this will log to stderr"""
# 		self.log(msg,infotype="e",lineno=lineno,filename=filename,force=True)
# 
# 	########
# 	#warning
# 	########
# 
# 	def warning(self,
# 				msg,
# 				lineno=0,
# 				filename=""):
# 		"""logs as warning message."""
# 		self.log(msg,infotype="w",lineno=lineno,filename=filename,force=False)
# 
# 	######
# 	#debug
# 	######
# 
# 	def debug(  self,
# 				msg,
# 				lineno=0,
# 				filename=""):
# 
# 		if filename=="":
# 			filename=self.filename
# 
# 		try:
# 			self.parent._logger._level+=self._level
# 			self.parent.debug(msg=msg,lineno=lineno,filename=filename)
# 			self.parent._logger._level-=self._level
# 		except:
# 			pass
# 
# Path: gmeutils/_dbg.py
# def _dbg(func):
# 
# 	@wraps(func)
# 	def wrapper(*args, **kwargs):
# 		parent=None
# 
# 		lineno=0
# 		endlineno=0
# 		filename=inspect.getfile(func)
# 
# 		if args:
# 
# 			if isinstance(args[0],child._gmechild):
# 				parent=args[0]
# 			elif hasattr(args[0],"send_mails"):
# 				parent=args[0]
# 			elif hasattr(args[0],"parent"):
# 				parent=args[0].parent
# 
# 		if not parent:
# 			print(">> START %s"%func.__name__,lineno)
# 			result=func(*args,**kwargs)
# 			print(">> END %s"%func.__name__,lineno)
# 			return result
# 
# 
# 		try:
# 			source=inspect.getsourcelines(func)
# 			lineno=source[1]
# 			endlineno=lineno+len(source[0])
# 		except:
# 			pass
# 
# 		if (hasattr(parent,"_logger") and 
# 			hasattr(parent._logger,"_level")):
# 			parent._logger._level+=1
# 
# 		parent.debug("START %s"%func.__name__,lineno,filename)
# 		result=func(*args,**kwargs)
# 		parent.debug("END %s"%func.__name__,endlineno,filename)
# 
# 		if (hasattr(parent,"_logger") and 
# 			hasattr(parent._logger,"_level")):
# 			parent._logger._level-=1
# 
# 			if parent._logger._level<0:
# 				parent._logger._level=0
# 
# 		return result
# 
# 	return wrapper


# Path: gmeutils/mylogger.py
import os
import inspect
import time
import sys
	import logging
	import logging.handlers
	import syslog
from .child 			import _gmechild
from .version 			import *
from   ._dbg 			import _dbg
from   gmeutils.helpers			import *

#License GPL v3
#Author Horst Knorr <gpgmailencrypt@gmx.de>


if os.name=="nt":
else:

LOG_DEBUG=1
LOG_INFO=2
LOG_WARNING=3
LOG_ERR=4

################
# CLASS mylogger
################


class mylogger(_gmechild):