So many ways...
Level switches (mechanical float switch on the inside or capacitive on the outside of the cup), ultrasound (from above, measure where the surface is), pressure (at the bottom of the container), weight of the container, just to name a few.
For logging the data: get a NodeMCU, connect to your local WiFi network, and write your stuff directly to a MySQL database using the MySQL connector.