fixes #540 - Update log encoder for modern use. Also fixes a bug in scalar encoder. Other misc cleanups.

@subutai These changes are required to get Log Encoder working properly with OPF. They also make log encoder more closely match the scalar encoder interface that it wraps.