# -*- coding: utf-8 -*-

import aop
import datetime


def printDate(time):
    print(time)

def add(num1,num2):
    return num1+num2

def log(func,*args,**kwargs):
    funcreturn = func(*args,**kwargs)
    print("func %s be invoke"%func.__name__)
    print ('param is ',args )
    return funcreturn

# 注册log advice到所有方法
aop.registeAdvice('',log)

# 获取代理并调用printdate方法
aop.getProxy(printDate)(datetime.datetime.today())

# 获取代理并调用add方法
print (aop.getProxy(add)(1,3))
a3b031c8b8a6baf83a7095d6a6b494a0b14f6946
<mask token>


def printDate(time):
    print(time)


<mask token>


def log(func, *args, **kwargs):
    funcreturn = func(*args, **kwargs)
    print('func %s be invoke' % func.__name__)
    print('param is ', args)
    return funcreturn


<mask token>

<mask token>


def printDate(time):
    print(time)


def add(num1, num2):
    return num1 + num2


def log(func, *args, **kwargs):
    funcreturn = func(*args, **kwargs)
    print('func %s be invoke' % func.__name__)
    print('param is ', args)
    return funcreturn


<mask token>

<mask token>


def printDate(time):
    print(time)


def add(num1, num2):
    return num1 + num2


def log(func, *args, **kwargs):
    funcreturn = func(*args, **kwargs)
    print('func %s be invoke' % func.__name__)
    print('param is ', args)
    return funcreturn


aop.registeAdvice('', log)
aop.getProxy(printDate)(datetime.datetime.today())
print(aop.getProxy(add)(1, 3))

import aop
import datetime


def printDate(time):
    print(time)


def add(num1, num2):
    return num1 + num2


def log(func, *args, **kwargs):
    funcreturn = func(*args, **kwargs)
    print('func %s be invoke' % func.__name__)
    print('param is ', args)
    return funcreturn


aop.registeAdvice('', log)
aop.getProxy(printDate)(datetime.datetime.today())
print(aop.getProxy(add)(1, 3))

# -*- coding: utf-8 -*-

import aop
import datetime


def printDate(time):
    print(time)

def add(num1,num2):
    return num1+num2

def log(func,*args,**kwargs):
    funcreturn = func(*args,**kwargs)
    print("func %s be invoke"%func.__name__)
    print ('param is ',args )
    return funcreturn

# 注册log advice到所有方法
aop.registeAdvice('',log)

# 获取代理并调用printdate方法
aop.getProxy(printDate)(datetime.datetime.today())

# 获取代理并调用add方法
print (aop.getProxy(add)(1,3))