meta data for this page
Kernel
printk
modify format for vprintk
To modify format string to f.e.:
- add log level
- add prefix
- solve [https://stackoverflow.com/questions/54430645/how-to-use-a-variable-as-a-format-string-in-printk|How to use a variable as a format string in printk]]
Special structure struct va_format
and special format character %pV
was added to Kernel.
Examples:
va_list args; struct va_format vaf = { .fmt = format, }; va_start(args, format); vaf.va = &args; printk(KERN_DEBUG "[TPS] %pV", &vaf); va_end(args);