Log.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* GRAPHITE2 LICENSING
  2. Copyright 2010, SIL International
  3. All rights reserved.
  4. This library is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published
  6. by the Free Software Foundation; either version 2.1 of License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should also have received a copy of the GNU Lesser General Public
  13. License along with this library in the file named "LICENSE".
  14. If not, write to the Free Software Foundation, 51 Franklin Street,
  15. Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
  16. internet at http://www.fsf.org/licenses/lgpl.html.
  17. Alternatively, the contents of this file may be used under the terms
  18. of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
  19. General Public License, as published by the Free Software Foundation,
  20. either version 2 of the License or (at your option) any later version.
  21. */
  22. #pragma once
  23. #include <graphite2/Types.h>
  24. #include <graphite2/Font.h>
  25. #include <stdio.h>
  26. #ifdef __cplusplus
  27. extern "C"
  28. {
  29. #endif
  30. /** deprecated mechanism that doesn't do anything now. */
  31. typedef enum {
  32. GRLOG_NONE = 0x0,
  33. GRLOG_FACE = 0x01,
  34. GRLOG_SEGMENT = 0x02,
  35. GRLOG_PASS = 0x04,
  36. GRLOG_CACHE = 0x08,
  37. GRLOG_OPCODE = 0x80,
  38. GRLOG_ALL = 0xFF
  39. } GrLogMask;
  40. /** Start logging all segment creation and updates on the provided face. This
  41. * is logged to a JSON file, see "Segment JSON Schema.txt" for a precise
  42. * definition of the file
  43. *
  44. * @return true if the file was successfully created and logging is correctly
  45. * initialised.
  46. * @param face the gr_face whose segments you want to log to the given file
  47. * @param log_path a utf8 encoded file name and path to log to.
  48. */
  49. GR2_API bool gr_start_logging(gr_face * face, const char *log_path);
  50. /** Stop logging on the given face. This will close the log file created by
  51. * gr_start_logging.
  52. *
  53. * @param face the gr_face whose segments you want to stop logging
  54. */
  55. GR2_API void gr_stop_logging(gr_face * face);
  56. /** Start logging to a FILE object.
  57. * This function is deprecated as of 1.2.0, use the _face versions instead.
  58. *
  59. * @return True on success
  60. * @param logfile FILE reference to output logging to
  61. * @param mask What aspects of logging to report (ignored)
  62. */
  63. GR2_API bool graphite_start_logging(FILE * logFile, GrLogMask mask); //may not do anthing if disabled in the implementation of the engine.
  64. /** Stop logging to a FILE object.
  65. * This function is deprecated as of 1.2.0, use the _face versions instead.
  66. */
  67. GR2_API void graphite_stop_logging();
  68. #ifdef __cplusplus
  69. }
  70. #endif