morgan(
":remote-addr :method :url :status :res[content-length] :response-time ms"
);
For example, if :res[content-length] is not available, then it will print a "-" in its place. How do I change this dash to something else?
morgan(
":remote-addr :method :url :status :res[content-length] :response-time ms"
);
For example, if :res[content-length] is not available, then it will print a "-" in its place. How do I change this dash to something else?
The
"-"is hardcoded in thecompilefunction here which runs when the value behind the token isundefined.The
tokensmethod can be used to provide a custom string when the value behind the token is missing, i.e.undefined. You can use it to overwrite predefined tokens used in your format string passed tomorgan. Here is an example overwriting the predefined:restoken and replacing the-with<!>if the token value isundefined.