I’m doing it on my own apps, so it’s quite simple. I just initialize the serial port in main() and print whatever I want to it:
// USART1 8N1 115200bps debug port
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
USART1->BRR = 72000000 / 115200;
USART1->CR1 = USART_CR1_UE | USART_CR1_TE | USART_CR1_RE;
gpio_usart1_tx_mode(GPIO_AFOUT_10);
gpio_usart1_rx_mode(GPIO_HIGHZ_INPUT);
printf("\nBoot!\n");
But obviously that needs some libc etc. for printf to function. My Logic Analyzer application has some debug output (not very relevant to the user, of course); if you are interested the source is here, check main.cc and libc_glue.c.