In a large skillet over medium heat, melt the butter. As soon as it's foaming, add the sliced onion and leek, as well as a pinch of salt.
Cook, stirring every minute or so, until the onions start to soften and turn translucent, about 10 minutes.
Reduce heat to medium-low and continue to cook, stirring every now and then. If brown bits are forming on the bottom of your pan, add a little water and use it to scrape them off and stir them into the mixture. If this is happening too often and you're worried your onions will burn, you can reduce the heat a little. Keep cooking, adjusting the heat level as needed, until the onions and leeks are soft and beginning to turn golden, which will take around 30 minutes.
Continue to cook for another 10 minutes or until the mixture starts to darken. Watch carefully at this point to make sure the mixture does not burn, stirring as needed. The onions and leeks are done when they reach your preferred level of caramelization, so this may take a bit longer if you like them darker. Taste and add more salt if required, then remove from heat.