log.c 915 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. * This component and the accompanying materials are made available
  5. * under the terms of the License "Eclipse Public License v1.0"
  6. * which accompanies this distribution, and is available
  7. * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  8. *
  9. * Initial Contributors:
  10. * Nokia Corporation - initial contribution.
  11. *
  12. * Contributors:
  13. *
  14. * Description:
  15. *
  16. */
  17. #include "log.h"
  18. #include <stdarg.h>
  19. #include <stdio.h>
  20. int loglevel=LOGNORMAL;
  21. int debug(const char *format, ...)
  22. {
  23. int rt=0;
  24. if (loglevel >= LOGDEBUG)
  25. {
  26. va_list ap;
  27. va_start(ap, format);
  28. rt = vfprintf(stderr, format, ap);
  29. va_end(ap);
  30. }
  31. return rt;
  32. }
  33. int error(const char *format, ...)
  34. {
  35. int rt=0;
  36. if (loglevel >= LOGNORMAL)
  37. {
  38. va_list ap;
  39. va_start(ap, format);
  40. rt = vfprintf(stderr, format, ap);
  41. va_end(ap);
  42. }
  43. return rt;
  44. }