summaryrefslogtreecommitdiff
path: root/src/objclass/class_debug.cc
blob: 39059b578fde2eb1df0045eeb21893ab493d57a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <iostream>

#include "common/config.h"
#include "global/debug.h"

#include "objclass.h"

#define dout_subsys ceph_subsys_objclass

int cls_log(int level, const char *format, ...)
{
   int size = 256, n;
   va_list ap;
   while (1) {
     char buf[size];
     va_start(ap, format);
     n = vsnprintf(buf, size, format, ap);
     va_end(ap);
#define MAX_SIZE 8196
     if ((n > -1 && n < size) || size > MAX_SIZE) {
       dout(level) << buf << dendl;
       return n;
     }
     size *= 2;
   }
}