- EventsBuf *eb;
- char buf[BUF];
- nat size;
-
- size = vsnprintf(buf,BUF,msg,ap);
- if (size > BUF) {
- buf[BUF-1] = '\0';
- size = BUF;
- }
-
- eb = &capEventBuf[cap->no];
-
- if (!hasRoomForVariableEvent(eb, size)) {
- // Flush event buffer to make room for new event.
- printAndClearEventBuf(eb);
- }
-
- postEventHeader(eb, EVENT_LOG_MSG);
- postPayloadSize(eb, size + sizeof(EventCapNo));
- postCapNo(eb, cap->no);
- postBuf(eb,(StgWord8*)buf,size);