Sometimes you need to include current layer(s) information to your renders, so they could be identified by a viewer or yourself or just for debugging purposes. Here's how.
1. Create an empty text layer
2. Unfold its properties to Text -> Source Text
3. Click its stopwatch while pressing Alt (it enables the expression for the Source Text)
4. Paste this expression:
So your layer should look like this:
5. You're done. Adjust the text layer's size, font, color and position to your preferences as usual. This expression creates text with your composition name and current layer(s) numbers. If you do not want it to be included in the actual render, use Layer -> Guide Layer option
Or if there's more than one layer active at current time:
This expression takes in account all the layers below itself, so to include all of comp layers make this text layer the topmost.
The expression can be slow if you have some huge amount of layers in your comp.
It's also very easy to get the layers names instead of their numbers. Here's the version for it: