Skip to content

Instantly share code, notes, and snippets.

View Kazy's full-sized avatar
🍡

Jocelyn Boullier Kazy

🍡
  • Paris, France
View GitHub Profile
@romgrk
romgrk / surround-function.vim
Last active September 18, 2021 18:53
Adds ability to manipulate function calls with vim-surround
" This lets vim-surround be able to surround a motion with a function-call,
" but it's not smart enough to handle delete-surrounding & change-surrounding,
" so it's handled by the functions below
let surround_{char2nr("f")} = "\1func: \1(\r)"
" Mappings
nmap dsf :call DSurroundFunc()<CR>
@danmikita
danmikita / init.vim
Created November 16, 2018 19:16
File preview with FZF, RG, Bat, and Devicons
nnoremap <silent> <leader>e :call Fzf_dev()<CR>
" ripgrep
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"'
set grepprg=rg\ --vimgrep
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
endif
" Files + devicons
@nymous
nymous / README.md
Last active October 21, 2025 22:08
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom