Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
using(SomeProfiler.Instance.LogCallFor("MyFunction(some, params, etc)"))
{
// Execute some stuff
}class Object
alias :to_s_old :to_s
def to_s
begin
# Here goes logging code (before call)
self.to_s
# Here goes logging code (after call and normal termination)
rescue
# Here goes logging code (after call and termination w/ exception)
end
endclass Object
alias :to_s_old :to_s
def to_s
begin
# Here goes logging code (before call)
self.to_s_old
# Here goes logging code (after call and normal termination)
rescue
# Here goes logging code (after call and termination w/ exception)
end
endaddCallListener(f, {
before: function(){},
afterComplete: function(){}, // вызывается, если нет исключений
after: function(){}, // вызываемся всегда
error: function(){},
});
[].slice.call(arguments)
Эмуляция события вызова функции