Not an app, but a device that will monitor power usage, like a kill a watt, is really handy for this sort of thing. You can tell right away if it is in a low power charging mode.
As others have said, the actual problem is probably a dirty port on your phone. The cable will wear out over time as well, so trying a different one may also help.
Which law?
I ask, because many times people point to the first amendment for things like this, but that doesn’t apply here.