/core/externals/update-engine/externals/gdata-objectivec-client/Source/HTTPFetcher/GTMHTTPFetcherLogging.h

http://macfuse.googlecode.com/ · C++ Header · 103 lines · 26 code · 14 blank · 63 comment · 0 complexity · 26e4f027b345f78911759d5612c85594 MD5 · raw file

  1. /* Copyright (c) 2010 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #import "GTMHTTPFetcher.h"
  16. // GTM HTTP Logging
  17. //
  18. // All traffic using GTMHTTPFetcher can be easily logged. Call
  19. //
  20. // [GTMHTTPFetcher setLoggingEnabled:YES];
  21. //
  22. // to begin generating log files.
  23. //
  24. // Log files are put into a folder on the desktop called "GTMHTTPDebugLogs"
  25. // unless another directory is specified with +setLoggingDirectory.
  26. //
  27. // In the iPhone simulator, the default logs location is the user's home
  28. // directory in ~/Library/Application Support. On the iPhone device, the
  29. // default logs location is the application's documents directory on the device.
  30. //
  31. // Tip: use the Finder's "Sort By Date" to find the most recent logs.
  32. //
  33. // Each run of an application gets a separate set of log files. An html
  34. // file is generated to simplify browsing the run's http transactions.
  35. // The html file includes javascript links for inline viewing of uploaded
  36. // and downloaded data.
  37. //
  38. // A symlink is created in the logs folder to simplify finding the html file
  39. // for the latest run of the application; the symlink is called
  40. //
  41. // AppName_http_log_newest.html
  42. //
  43. // For better viewing of XML logs, use Camino or Firefox rather than Safari.
  44. //
  45. // Each fetcher may be given a comment to be inserted as a label in the logs,
  46. // such as
  47. // [fetcher setCommentWithFormat:@"retrieve item %@", itemName];
  48. //
  49. // Projects may define STRIP_GTM_FETCH_LOGGING to remove logging code.
  50. #if !STRIP_GTM_FETCH_LOGGING
  51. @interface GTMHTTPFetcher (GTMHTTPFetcherLogging)
  52. // Note: the default logs directory is ~/Desktop/GTMHTTPDebugLogs; it will be
  53. // created as needed. If a custom directory is set, the directory should
  54. // already exist.
  55. + (void)setLoggingDirectory:(NSString *)path;
  56. + (NSString *)loggingDirectory;
  57. // client apps can turn logging on and off
  58. + (void)setLoggingEnabled:(BOOL)flag;
  59. + (BOOL)isLoggingEnabled;
  60. // client apps can turn off logging to a file if they want to only check
  61. // the fetcher's log property
  62. + (void)setLoggingToFileEnabled:(BOOL)flag;
  63. + (BOOL)isLoggingToFileEnabled;
  64. // client apps can optionally specify process name and date string used in
  65. // log file names
  66. + (void)setLoggingProcessName:(NSString *)str;
  67. + (NSString *)loggingProcessName;
  68. + (void)setLoggingDateStamp:(NSString *)str;
  69. + (NSString *)loggingDateStamp;
  70. // internal; called by fetcher
  71. - (void)logFetchWithError:(NSError *)error;
  72. - (BOOL)logCapturePostStream;
  73. // internal; accessors useful for viewing logs
  74. + (NSString *)processNameLogPrefix;
  75. + (NSString *)symlinkNameSuffix;
  76. + (NSString *)htmlFileName;
  77. // Applications may provide alternative body strings to be displayed in the
  78. // log, such as for binary requests or responses. If deferring is turned
  79. // on, the response log will not be sent until deferring is turned off,
  80. // allowing the application to write the response body after the response
  81. // data has been parsed.
  82. - (void)setLogRequestBody:(NSString *)bodyString;
  83. - (NSString *)logRequestBody;
  84. - (void)setLogResponseBody:(NSString *)bodyString;
  85. - (NSString *)logResponseBody;
  86. - (void)setShouldDeferResponseBodyLogging:(BOOL)flag;
  87. - (BOOL)shouldDeferResponseBodyLogging;
  88. @end
  89. #endif // !STRIP_GTM_FETCH_LOGGING