You can't.
But there is an open issue which asks for this feature, as well as an item in the todo list which suggests that such a feature would be merged if someone was willing to work on it:
Add <aevent>, which expands to the currently triggered autocommand event name.
(Daniel Hahler, #4232) Or add it to v:event (easier to use but slightly more
expensive).
In the meantime, you need one autocmd per event:
augroup EventLogger
autocmd!
autocmd BufWrite * call LogOutput('BufWrite')
autocmd BufEnter * call LogOutput('BufEnter')
autocmd User * call LogOutput('User')
augroup END
For all events, try something like this:
augroup EventLogger
autocmd!
let events = getcompletion('', 'event')
for event in events
exe printf('au %s * call LogOutput("%s")', event, event)
endfor
augroup END
I get the following when trying to do some things: Error detected while processing FuncUndefined Autocommands for "*": E218: autocommand nesting too deep
Don't install autocmds for events which cause such issues, such as FuncUndefined
:
augroup EventLogger
autocmd!
let s:EVENTS = getcompletion('', 'event')
const s:DANGEROUS =<< trim END
BufReadCmd
BufWriteCmd
FileAppendCmd
FileReadCmd
FileWriteCmd
FuncUndefined
SourceCmd
END
const s:SYNONYMS =<< trim END
BufCreate
BufRead
BufWrite
END
const s:TOO_FREQUENT =<< trim END
CmdlineChanged
CmdlineEnter
CmdlineLeave
SafeState
SafeStateAgain
END
call filter(s:EVENTS, {_,v -> index(s:DANGEROUS + s:SYNONYMS + s:TOO_FREQUENT, v, 0, 1) == -1})
for s:event in s:EVENTS
exe printf('au %s * call LogOutput("%s")', s:event, s:event)
endfor
unlet! s:event s:EVENTS s:DANGEROUS s:SYNONYMS s:TOO_FREQUENT
augroup END