Log.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later */
  2. /* Copyright 2010, SIL International, All rights reserved. */
  3. #pragma once
  4. #include <graphite2/Types.h>
  5. #include <graphite2/Font.h>
  6. #include <stdio.h>
  7. #ifdef __cplusplus
  8. extern "C"
  9. {
  10. #endif
  11. /** deprecated mechanism that doesn't do anything now. */
  12. typedef enum {
  13. GRLOG_NONE = 0x0,
  14. GRLOG_FACE = 0x01,
  15. GRLOG_SEGMENT = 0x02,
  16. GRLOG_PASS = 0x04,
  17. GRLOG_CACHE = 0x08,
  18. GRLOG_OPCODE = 0x80,
  19. GRLOG_ALL = 0xFF
  20. } GrLogMask;
  21. /** Start logging all segment creation and updates on the provided face. This
  22. * is logged to a JSON file, see "Segment JSON Schema.txt" for a precise
  23. * definition of the file
  24. *
  25. * @return true if the file was successfully created and logging is correctly
  26. * initialised.
  27. * @param face the gr_face whose segments you want to log to the given file
  28. * @param log_path a utf8 encoded file name and path to log to.
  29. */
  30. GR2_API bool gr_start_logging(gr_face * face, const char *log_path);
  31. /** Stop logging on the given face. This will close the log file created by
  32. * gr_start_logging.
  33. *
  34. * @param face the gr_face whose segments you want to stop logging
  35. */
  36. GR2_API void gr_stop_logging(gr_face * face);
  37. /** Start logging to a FILE object.
  38. * This function is deprecated as of 1.2.0, use the _face versions instead.
  39. *
  40. * @return True on success
  41. * @param logfile FILE reference to output logging to
  42. * @param mask What aspects of logging to report (ignored)
  43. */
  44. GR2_API bool graphite_start_logging(FILE * logFile, GrLogMask mask); //may not do anthing if disabled in the implementation of the engine.
  45. /** Stop logging to a FILE object.
  46. * This function is deprecated as of 1.2.0, use the _face versions instead.
  47. */
  48. GR2_API void graphite_stop_logging();
  49. #ifdef __cplusplus
  50. }
  51. #endif