String literals widen to string unless you freeze them. as const keeps exact literals and makes arrays/objects read-only. From a literal array, you can build a union of its items.
You will define a set of log levels using as const and use that union in a function.
const COLORS = ["red", "green", "blue"] as const;
type Color = (typeof COLORS)[number];
Build levels with as const and tag messages.