MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / logger

Function logger

src/core/imap/MCIMAPSession.cpp:580–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580static void logger(mailimap * imap, int log_type, const char * buffer, size_t size, void * context)
581{
582 IMAPSession * session = (IMAPSession *) context;
583 session->lockConnectionLogger();
584
585 if (session->connectionLoggerNoLock() == NULL) {
586 session->unlockConnectionLogger();
587 return;
588 }
589
590 ConnectionLogType type = getConnectionType(log_type);
591 if ((int) type == -1) {
592 session->unlockConnectionLogger();
593 return;
594 }
595
596 bool isBuffer = isBufferFromLogType(log_type);
597
598 if (isBuffer) {
599 AutoreleasePool * pool = new AutoreleasePool();
600 Data * data = Data::dataWithBytes(buffer, (unsigned int) size);
601 session->connectionLoggerNoLock()->log(session, type, data);
602 pool->release();
603 }
604 else {
605 session->connectionLoggerNoLock()->log(session, type, NULL);
606 }
607 session->unlockConnectionLogger();
608}
609
610void IMAPSession::setup()
611{

Callers

nothing calls this directly

Calls 5

releaseMethod · 0.80
logMethod · 0.65
lockConnectionLoggerMethod · 0.45

Tested by

no test coverage detected