Consistent int return type and add'l signature for count by state calls
First pass at flush-logs command (See #4).