NullMetricsPlugin.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Reflection;
  29. using OpenMetaverse;
  30. using log4net;
  31. namespace OpenSim.Grid.AssetInventoryServer.Plugins
  32. {
  33. public class NullMetricsPlugin : IMetricsProvider
  34. {
  35. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  36. //private AssetInventoryServer m_server;
  37. public NullMetricsPlugin()
  38. {
  39. }
  40. #region IMetricsProvider implementation
  41. public void LogAssetMetadataFetch(string extension, BackendResponse response, UUID assetID, DateTime time)
  42. {
  43. m_log.DebugFormat("[{0}]: AssetMetadataFetch(): AssetID: {1}, Response: {2}", extension, assetID, response);
  44. }
  45. public void LogAssetDataFetch(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time)
  46. {
  47. m_log.DebugFormat("[{0}]: AssetDataFetch(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
  48. dataSize, response);
  49. }
  50. public void LogAssetCreate(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time)
  51. {
  52. m_log.DebugFormat("[{0}]: AssetCreate(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
  53. dataSize, response);
  54. }
  55. public void LogInventoryFetch(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time)
  56. {
  57. m_log.DebugFormat("[{0}]: InventoryFetch(): ObjID: {1}, Folder: {2}, OwnerID: {3}, Response: {4}", extension,
  58. objID, folder, owner, response);
  59. }
  60. public void LogInventoryFetchFolderContents(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time)
  61. {
  62. m_log.DebugFormat("[{0}]: InventoryFetchFolderContents(): FolderID: {1}, OwnerID: {2}, Response: {3}", extension,
  63. folderID, owner, response);
  64. }
  65. public void LogInventoryFetchFolderList(string extension, BackendResponse response, Uri owner, DateTime time)
  66. {
  67. m_log.DebugFormat("[{0}]: InventoryFetchFolderList(): OwnerID: {1}, Response: {2}", extension,
  68. owner, response);
  69. }
  70. public void LogInventoryFetchInventory(string extension, BackendResponse response, Uri owner, DateTime time)
  71. {
  72. m_log.DebugFormat("[{0}]: InventoryFetchInventory(): OwnerID: {1}, Response: {2}", extension,
  73. owner, response);
  74. }
  75. public void LogInventoryFetchActiveGestures(string extension, BackendResponse response, Uri owner, DateTime time)
  76. {
  77. m_log.DebugFormat("[{0}]: InventoryFetchActiveGestures(): OwnerID: {1}, Response: {2}", extension,
  78. owner, response);
  79. }
  80. public void LogInventoryCreate(string extension, BackendResponse response, Uri owner, bool folder, DateTime time)
  81. {
  82. m_log.DebugFormat("[{0}]: InventoryCreate(): OwnerID: {1}, Response: {2}", extension,
  83. owner, response);
  84. }
  85. public void LogInventoryCreateInventory(string extension, BackendResponse response, DateTime time)
  86. {
  87. m_log.DebugFormat("[{0}]: InventoryCreateInventory(): Response: {1}", extension,
  88. response);
  89. }
  90. public void LogInventoryDelete(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time)
  91. {
  92. m_log.DebugFormat("[{0}]: InventoryDelete(): OwnerID: {1}, Folder: {2}, Response: {3}", extension,
  93. owner, folder, response);
  94. }
  95. public void LogInventoryPurgeFolder(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time)
  96. {
  97. m_log.DebugFormat("[{0}]: InventoryPurgeFolder(): OwnerID: {1}, FolderID: {2}, Response: {3}", extension,
  98. owner, folderID, response);
  99. }
  100. #endregion IMetricsProvider implementation
  101. #region IPlugin implementation
  102. public void Initialise(AssetInventoryServer server)
  103. {
  104. //m_server = server;
  105. }
  106. /// <summary>
  107. /// <para>Initialises metrics interface</para>
  108. /// </summary>
  109. public void Initialise()
  110. {
  111. m_log.Info("[NULLMETRICS]: Null metrics loaded.");
  112. }
  113. public void Dispose()
  114. {
  115. }
  116. public string Version
  117. {
  118. // TODO: this should be something meaningful and not hardcoded?
  119. get { return "0.1"; }
  120. }
  121. public string Name
  122. {
  123. get { return "NullMetrics"; }
  124. }
  125. #endregion IPlugin implementation
  126. }
  127. }