Permalink
Browse files

Initial import of Couchbase ELMAH provider with sample app

  • Loading branch information...
1 parent a8bf12b commit d366082e487cb72f6f28da26c6875594e85ac877 @johnzablocki johnzablocki committed Jul 23, 2012
Showing with 153,278 additions and 2 deletions.
  1. +30 −2 README.md
  2. BIN lib/Couchbase/Couchbase.dll
  3. BIN lib/Couchbase/Couchbase.pdb
  4. BIN lib/Couchbase/Enyim.Caching.dll
  5. BIN lib/Couchbase/Enyim.Caching.pdb
  6. BIN lib/Couchbase/Hammock.dll
  7. BIN lib/Couchbase/Hammock.pdb
  8. BIN lib/Couchbase/Newtonsoft.Json.dll
  9. BIN lib/Couchbase/Newtonsoft.Json.pdb
  10. +7,320 −0 lib/Couchbase/Newtonsoft.Json.xml
  11. +48 −0 src/Elmah.Couchbase/CouchbaseClientFactory.cs
  12. +146 −0 src/Elmah.Couchbase/CouchbaseErrorLog.cs
  13. +6 −0 src/Elmah.Couchbase/CouchbaseErrorLog.json
  14. +73 −0 src/Elmah.Couchbase/Elmah.Couchbase.csproj
  15. +2 −0 src/Elmah.Couchbase/Elmah.Couchbase.csproj.DotSettings.user
  16. +31 −0 src/Elmah.Couchbase/Elmah.Couchbase.sln
  17. +2 −0 src/Elmah.Couchbase/Elmah.Couchbase.sln.DotSettings.user
  18. BIN src/Elmah.Couchbase/Elmah.Couchbase.suo
  19. +36 −0 src/Elmah.Couchbase/Properties/AssemblyInfo.cs
  20. BIN src/Elmah.Couchbase/_ReSharper.Elmah.Couchbase/ProjectModel/projectModel.dat
  21. +5 −0 src/Elmah.Couchbase/packages.config
  22. BIN src/Elmah.Couchbase/packages/CouchbaseNetClient.1.1.6/CouchbaseNetClient.1.1.6.nupkg
  23. BIN src/Elmah.Couchbase/packages/CouchbaseNetClient.1.1.6/lib/net35/Couchbase.dll
  24. BIN src/Elmah.Couchbase/packages/CouchbaseNetClient.1.1.6/lib/net35/Couchbase.pdb
  25. +454 −0 src/Elmah.Couchbase/packages/CouchbaseNetClient.1.1.6/lib/net35/Couchbase.xml
  26. BIN src/Elmah.Couchbase/packages/CouchbaseNetClient.1.1.6/lib/net35/Enyim.Caching.dll
  27. BIN src/Elmah.Couchbase/packages/CouchbaseNetClient.1.1.6/lib/net35/Enyim.Caching.pdb
  28. +2,026 −0 src/Elmah.Couchbase/packages/CouchbaseNetClient.1.1.6/lib/net35/Enyim.Caching.xml
  29. BIN src/Elmah.Couchbase/packages/EntityFramework.4.1.10331.0/EntityFramework.4.1.10331.0.nupkg
  30. BIN src/Elmah.Couchbase/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.dll
  31. +13,206 −0 src/Elmah.Couchbase/packages/EntityFramework.4.1.10331.0/lib/EntityFramework.xml
  32. +969 −0 src/Elmah.Couchbase/packages/Modernizr.1.7/Content/Scripts/modernizr-1.7.js
  33. +10 −0 src/Elmah.Couchbase/packages/Modernizr.1.7/Content/Scripts/modernizr-1.7.min.js
  34. BIN src/Elmah.Couchbase/packages/Modernizr.1.7/Modernizr.1.7.nupkg
  35. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/Newtonsoft.Json.4.5.7.nupkg
  36. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/net20/Newtonsoft.Json.dll
  37. +8,204 −0 src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/net20/Newtonsoft.Json.xml
  38. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/net35/Newtonsoft.Json.dll
  39. +7,340 −0 src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/net35/Newtonsoft.Json.xml
  40. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/net40/Newtonsoft.Json.dll
  41. +7,583 −0 src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/net40/Newtonsoft.Json.xml
  42. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/sl3-wp/Newtonsoft.Json.dll
  43. +6,883 −0 src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/sl3-wp/Newtonsoft.Json.xml
  44. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/sl4-windowsphone71/Newtonsoft.Json.dll
  45. +6,883 −0 src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/sl4-windowsphone71/Newtonsoft.Json.xml
  46. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/sl4/Newtonsoft.Json.dll
  47. +6,905 −0 src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/sl4/Newtonsoft.Json.xml
  48. BIN src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/winrt45/Newtonsoft.Json.dll
  49. +7,101 −0 src/Elmah.Couchbase/packages/Newtonsoft.Json.4.5.7/lib/winrt45/Newtonsoft.Json.xml
  50. +15 −0 src/Elmah.Couchbase/packages/elmah.1.2.2/Readme.txt
  51. +15 −0 src/Elmah.Couchbase/packages/elmah.1.2.2/content/App_Readme/Elmah.txt
  52. +59 −0 src/Elmah.Couchbase/packages/elmah.1.2.2/content/web.config.transform
  53. BIN src/Elmah.Couchbase/packages/elmah.1.2.2/elmah.1.2.2.nupkg
  54. BIN src/Elmah.Couchbase/packages/elmah.corelibrary.1.2.2/elmah.corelibrary.1.2.2.nupkg
  55. BIN src/Elmah.Couchbase/packages/elmah.corelibrary.1.2.2/lib/Elmah.dll
  56. +8,325 −0 src/Elmah.Couchbase/packages/jQuery.1.5.1/Content/Scripts/jquery-1.5.1.js
  57. +19 −0 src/Elmah.Couchbase/packages/jQuery.1.5.1/Content/Scripts/jquery-1.5.1.min.js
  58. BIN src/Elmah.Couchbase/packages/jQuery.1.5.1/jQuery.1.5.1.nupkg
  59. BIN ...kages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  60. BIN ...ages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  61. BIN ...ages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  62. BIN ...ages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  63. BIN ...ages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  64. BIN ...ages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  65. BIN ...ages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  66. BIN ...ry.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  67. BIN ...packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_222222_256x240.png
  68. BIN ...packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_2e83ff_256x240.png
  69. BIN ...packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_454545_256x240.png
  70. BIN ...packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_888888_256x240.png
  71. BIN ...packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/images/ui-icons_cd0a0a_256x240.png
  72. +24 −0 ....Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.accordion.css
  73. +16 −0 src/Elmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.all.css
  74. +62 −0 ...uchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.autocomplete.css
  75. +11 −0 ...Elmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.base.css
  76. +43 −0 ...mah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.button.css
  77. +46 −0 ...Elmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.core.css
  78. +73 −0 ...Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.datepicker.css
  79. +26 −0 ...mah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.dialog.css
  80. +16 −0 ...ouchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.progressbar.css
  81. +25 −0 ....Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.resizable.css
  82. +15 −0 ...Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.selectable.css
  83. +29 −0 ...mah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.slider.css
  84. +23 −0 ...Elmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.tabs.css
  85. +257 −0 ...lmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Content/themes/base/jquery.ui.theme.css
  86. +11,700 −0 src/Elmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Scripts/jquery-ui-1.8.11.js
  87. +938 −0 src/Elmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/Content/Scripts/jquery-ui-1.8.11.min.js
  88. BIN src/Elmah.Couchbase/packages/jQuery.UI.Combined.1.8.11/jQuery.UI.Combined.1.8.11.nupkg
  89. +1,299 −0 src/Elmah.Couchbase/packages/jQuery.Validation.1.8.0/Content/Scripts/jquery.validate-vsdoc.js
  90. +1,162 −0 src/Elmah.Couchbase/packages/jQuery.Validation.1.8.0/Content/Scripts/jquery.validate.js
  91. +53 −0 src/Elmah.Couchbase/packages/jQuery.Validation.1.8.0/Content/Scripts/jquery.validate.min.js
  92. BIN src/Elmah.Couchbase/packages/jQuery.Validation.1.8.0/jQuery.Validation.1.8.0.nupkg
  93. +9,110 −0 src/Elmah.Couchbase/packages/jQuery.vsdoc.1.5.1/Content/Scripts/jquery-1.5.1-vsdoc.js
  94. BIN src/Elmah.Couchbase/packages/jQuery.vsdoc.1.5.1/jQuery.vsdoc.1.5.1.nupkg
  95. +5 −0 src/Elmah.Couchbase/packages/repositories.config
  96. +15 −0 src/ElmahCouchbaseSample/App_Readme/Elmah.txt
  97. +324 −0 src/ElmahCouchbaseSample/Content/Site.css
  98. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  99. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  100. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  101. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  102. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  103. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  104. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  105. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  106. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-icons_222222_256x240.png
  107. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-icons_2e83ff_256x240.png
  108. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-icons_454545_256x240.png
  109. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-icons_888888_256x240.png
  110. BIN src/ElmahCouchbaseSample/Content/themes/base/images/ui-icons_cd0a0a_256x240.png
  111. +24 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.accordion.css
  112. +16 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.all.css
  113. +62 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.autocomplete.css
  114. +11 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.base.css
  115. +43 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.button.css
  116. +46 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.core.css
  117. +73 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.datepicker.css
  118. +26 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.dialog.css
  119. +16 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.progressbar.css
  120. +25 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.resizable.css
  121. +15 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.selectable.css
  122. +29 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.slider.css
  123. +23 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.tabs.css
  124. +257 −0 src/ElmahCouchbaseSample/Content/themes/base/jquery.ui.theme.css
  125. +193 −0 src/ElmahCouchbaseSample/Controllers/AccountController.cs
  126. +23 −0 src/ElmahCouchbaseSample/Controllers/HomeController.cs
  127. +188 −0 src/ElmahCouchbaseSample/ElmahCouchbaseSample.csproj
  128. +2 −0 src/ElmahCouchbaseSample/ElmahCouchbaseSample.csproj.DotSettings.user
  129. +28 −0 src/ElmahCouchbaseSample/ElmahCouchbaseSample.csproj.user
  130. +1 −0 src/ElmahCouchbaseSample/Global.asax
  131. +40 −0 src/ElmahCouchbaseSample/Global.asax.cs
  132. +67 −0 src/ElmahCouchbaseSample/Models/AccountModels.cs
  133. +35 −0 src/ElmahCouchbaseSample/Properties/AssemblyInfo.cs
  134. +7,117 −0 src/ElmahCouchbaseSample/Scripts/MicrosoftAjax.debug.js
  135. +6 −0 src/ElmahCouchbaseSample/Scripts/MicrosoftAjax.js
  136. +408 −0 src/ElmahCouchbaseSample/Scripts/MicrosoftMvcAjax.debug.js
  137. +25 −0 src/ElmahCouchbaseSample/Scripts/MicrosoftMvcAjax.js
  138. +883 −0 src/ElmahCouchbaseSample/Scripts/MicrosoftMvcValidation.debug.js
  139. +55 −0 src/ElmahCouchbaseSample/Scripts/MicrosoftMvcValidation.js
  140. +9,110 −0 src/ElmahCouchbaseSample/Scripts/jquery-1.5.1-vsdoc.js
  141. +8,325 −0 src/ElmahCouchbaseSample/Scripts/jquery-1.5.1.js
  142. +19 −0 src/ElmahCouchbaseSample/Scripts/jquery-1.5.1.min.js
  143. +11,700 −0 src/ElmahCouchbaseSample/Scripts/jquery-ui-1.8.11.js
  144. +938 −0 src/ElmahCouchbaseSample/Scripts/jquery-ui-1.8.11.min.js
  145. +165 −0 src/ElmahCouchbaseSample/Scripts/jquery.unobtrusive-ajax.js
  146. +5 −0 src/ElmahCouchbaseSample/Scripts/jquery.unobtrusive-ajax.min.js
  147. +1,299 −0 src/ElmahCouchbaseSample/Scripts/jquery.validate-vsdoc.js
  148. +1,162 −0 src/ElmahCouchbaseSample/Scripts/jquery.validate.js
  149. +53 −0 src/ElmahCouchbaseSample/Scripts/jquery.validate.min.js
  150. +319 −0 src/ElmahCouchbaseSample/Scripts/jquery.validate.unobtrusive.js
  151. +5 −0 src/ElmahCouchbaseSample/Scripts/jquery.validate.unobtrusive.min.js
  152. +969 −0 src/ElmahCouchbaseSample/Scripts/modernizr-1.7.js
  153. +10 −0 src/ElmahCouchbaseSample/Scripts/modernizr-1.7.min.js
  154. +53 −0 src/ElmahCouchbaseSample/Views/Account/ChangePassword.cshtml
  155. +8 −0 src/ElmahCouchbaseSample/Views/Account/ChangePasswordSuccess.cshtml
  156. +48 −0 src/ElmahCouchbaseSample/Views/Account/LogOn.cshtml
  157. +61 −0 src/ElmahCouchbaseSample/Views/Account/Register.cshtml
  158. +8 −0 src/ElmahCouchbaseSample/Views/Home/About.cshtml
  159. +8 −0 src/ElmahCouchbaseSample/Views/Home/Index.cshtml
  160. +9 −0 src/ElmahCouchbaseSample/Views/Shared/Error.cshtml
  161. +33 −0 src/ElmahCouchbaseSample/Views/Shared/_Layout.cshtml
  162. +7 −0 src/ElmahCouchbaseSample/Views/Shared/_LogOnPartial.cshtml
  163. +58 −0 src/ElmahCouchbaseSample/Views/Web.config
  164. +3 −0 src/ElmahCouchbaseSample/Views/_ViewStart.cshtml
  165. +30 −0 src/ElmahCouchbaseSample/Web.Debug.config
  166. +31 −0 src/ElmahCouchbaseSample/Web.Release.config
  167. +126 −0 src/ElmahCouchbaseSample/Web.config
  168. +11 −0 src/ElmahCouchbaseSample/packages.config
View
@@ -1,4 +1,32 @@
elmah-couchbase
-===============
+===========================
-Couchbase provider for ELMAH
+Logging provider for using Couchbase Server 2.0 with ELMAH.
+
+#Usage
+
+##Configure the Couchbase .NET Client Library
+
+ <section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase" />
+
+ <couchbase>
+ <documentNameTransformer type="Couchbase.Configuration.DevelopmentModeNameTransformer, Couchbase" />
+ <httpClientFactory type="Couchbase.HammockHttpClientFactory, Couchbase" />
+ <servers bucket="default">
+ <add uri="http://127.0.0.1:8091/pools" />
+ </servers>
+ </couchbase>
+
+##Configure elmah-couchbase
+
+ <elmah>
+ <errorLog type="Elmah.Couchbase.CouchbaseErrorLog, Elmah.Couchbase" couchbaseConfigSection="<other-than-default-couchbase-section-name>" />
+ </elmah>
+
+To learn how to configure multiple buckets, see http://www.couchbase.com/wiki/display/couchbase/Couchbase+.NET+Client+Library.
+
+#Notes
+
+Couchbase Server 2.0 required. Developer preview version of .NET Client Library for Couchbase included in "lib" directory.
+
+Be sure to deploy the view found in CouchbaseErrorLog.json at the root of the provider.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Couchbase;
+using Couchbase.Configuration;
+using System.Configuration;
+
+namespace Elmah.Couchbase
+{
+ public static class CouchbaseClientFactory
+ {
+ public static CouchbaseClient CreateCouchbaseClient(string couchbaseConfigSection = null)
+ {
+ if (couchbaseConfigSection != null)
+ {
+ var config = ConfigurationManager.GetSection(couchbaseConfigSection) as ICouchbaseClientConfiguration;
+ if (config == null)
+ throw new ArgumentException("Couchbase config section " + couchbaseConfigSection + " not found.");
+
+ return new CouchbaseClient(config);
+ }
+
+ return new CouchbaseClient();
+ }
+ }
+}
+
+#region [ License information ]
+/* ************************************************************
+ *
+ * @author Couchbase <info@couchbase.com>
+ * @copyright 2012 Couchbase, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ************************************************************/
+#endregion
@@ -0,0 +1,146 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Couchbase;
+using System.Collections;
+using Couchbase.Configuration;
+using Elmah;
+using Enyim.Caching.Memcached;
+using Newtonsoft.Json;
+
+namespace Elmah.Couchbase
+{
+ /// <summary>
+ /// ErrorLog implementation using Couchbase Server 2.0 as backing store.
+ /// </summary>
+ public class CouchbaseErrorLog : ErrorLog
+ {
+ private static CouchbaseClient _client;
+
+ /// <summary>
+ /// Initialize new instance of CouchbaseClient using either default config
+ /// or specified configuration name
+ /// </summary>
+ public CouchbaseErrorLog(IDictionary config)
+ {
+ if (config == null)
+ throw new ArgumentNullException("config");
+
+ if (_client == null)
+ {
+ if (config.Contains("couchbaseConfigSection"))
+ {
+ _client = CouchbaseClientFactory.CreateCouchbaseClient(config["couchbaseConfigSection"] as string);
+ }
+ else
+ {
+ _client = CouchbaseClientFactory.CreateCouchbaseClient();
+ }
+
+ if (config.Contains("applicationName"))
+ {
+ ApplicationName = config["applicationName"] as string;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Get error log entry by id
+ /// </summary>
+ public override ErrorLogEntry GetError(string id)
+ {
+ if (string.IsNullOrEmpty(id))
+ throw new ArgumentNullException("id");
+
+ Guid errorGuid;
+ try
+ {
+ errorGuid = new Guid(id);
+ }
+ catch (FormatException e)
+ {
+ throw new ArgumentException(e.Message, "id", e);
+ }
+
+ var errorJson = _client.Get<string>(id);
+ var error = JsonConvert.DeserializeObject<Error>(errorJson);
+ return new ErrorLogEntry(this, id, error);
+ }
+
+ /// <summary>
+ /// Get list of errors for view in Elmah web viewer
+ /// </summary>
+ public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
+ {
+ if (pageIndex < 0)
+ throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);
+
+ if (pageSize < 0)
+ throw new ArgumentOutOfRangeException("pageSize", pageSize, null);
+
+ var skip = pageSize * pageIndex;
+
+ //this is NOT the most efficient way to page in Couchbase/CouchDB, but is necessary because
+ //there is no way to keep state of the startkey between requests
+ //see http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writing-querying-pagination.html
+ //for more information
+ var view = _client.GetView("errors", "by_date").Descending(true).Skip(skip).Limit(pageSize);
+
+ foreach (var item in view)
+ {
+ var errorLogEntry = GetError(item.ItemId);
+ errorEntryList.Add(errorLogEntry);
+ }
+
+ return view.TotalRows;
+ }
+
+ /// <summary>
+ /// Log an error
+ /// </summary>
+ public override string Log(Error error)
+ {
+ if (error == null)
+ throw new ArgumentNullException("error");
+
+ var key = Guid.NewGuid().ToString();
+ _client.Store(StoreMode.Set, key, JsonConvert.SerializeObject(error));
+
+ return key;
+ }
+
+ /// <summary>
+ /// Name displayed in ELMAH viewer
+ /// </summary>
+ public override string Name
+ {
+ get
+ {
+ return "Couchbase Server Error Log";
+ }
+ }
+
+ }
+}
+
+#region [ License information ]
+/* ************************************************************
+ *
+ * @author Couchbase <info@couchbase.com>
+ * @copyright 2012 Couchbase, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ************************************************************/
+#endregion
@@ -0,0 +1,6 @@
+//view code for Elmah viewer. Must be named "by_date" and located in design document named "errors" without the quotes.
+function (doc) {
+ if (doc.Exception) {
+ emit(doc.Time, null);
+ }
+}
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{BAA4BB41-7894-4C7F-98E1-3921FE4FE675}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Elmah.Couchbase</RootNamespace>
+ <AssemblyName>Elmah.Couchbase</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Couchbase, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Couchbase\Couchbase.dll</HintPath>
+ </Reference>
+ <Reference Include="Elmah">
+ <HintPath>packages\elmah.corelibrary.1.2.2\lib\Elmah.dll</HintPath>
+ </Reference>
+ <Reference Include="Enyim.Caching, Version=2.12.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\lib\Couchbase\Enyim.Caching.dll</HintPath>
+ </Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CouchbaseClientFactory.cs" />
+ <Compile Include="CouchbaseErrorLog.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="CouchbaseErrorLog.json" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
@@ -0,0 +1,2 @@
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+ <s:Boolean x:Key="/Default/Housekeeping/ProjectSettingsUpgraded/IsUpgraded/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elmah.Couchbase", "Elmah.Couchbase.csproj", "{BAA4BB41-7894-4C7F-98E1-3921FE4FE675}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElmahCouchbaseSample", "..\ElmahCouchbaseSample\ElmahCouchbaseSample.csproj", "{7F2B73D5-6AD3-4727-B47A-B16FEEF7C41D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5813B801-2877-4F71-BD2E-FBF1856C8137}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\README.md = ..\..\README.md
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {BAA4BB41-7894-4C7F-98E1-3921FE4FE675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BAA4BB41-7894-4C7F-98E1-3921FE4FE675}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BAA4BB41-7894-4C7F-98E1-3921FE4FE675}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BAA4BB41-7894-4C7F-98E1-3921FE4FE675}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7F2B73D5-6AD3-4727-B47A-B16FEEF7C41D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7F2B73D5-6AD3-4727-B47A-B16FEEF7C41D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7F2B73D5-6AD3-4727-B47A-B16FEEF7C41D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7F2B73D5-6AD3-4727-B47A-B16FEEF7C41D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -0,0 +1,2 @@
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+ <s:Boolean x:Key="/Default/Housekeeping/SolutionSettingsUpgraded/IsUpgraded/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
Binary file not shown.
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Elmah.Couchbase")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Elmah.Couchbase")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("1601fc5d-5c30-4993-ae96-6f7bcfc3221a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Oops, something went wrong.

0 comments on commit d366082

Please sign in to comment.