Logic hooks doesn't always work that well, in the sense that the code needs to be eval'd and there is only a limited number of functionality that can be added with a single piece of code.
Instead of using logic hooks, use event observers instead, that allows a plugin to be written as an entire class, and on certain events, a function of the class can be called.
I've tried something like this before, the problem is that the function doesn't have access to the variables outside of it self unless they are explicitly passed to it, which would require having to pass any and all variables to each function.
Where as when using eval, the code can access anything and everything.