OLD | NEW |
1 #region Copyright notice and license | 1 #region Copyright notice and license |
2 // Protocol Buffers - Google's data interchange format | 2 |
3 // Copyright 2008 Google Inc. All rights reserved. | 3 // Copyright 2016, Google Inc. |
4 // https://developers.google.com/protocol-buffers/ | 4 // All rights reserved. |
5 // | 5 // |
6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
8 // met: | 8 // met: |
9 // | 9 // |
10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
11 // notice, this list of conditions and the following disclaimer. | 11 // notice, this list of conditions and the following disclaimer. |
12 // * Redistributions in binary form must reproduce the above | 12 // * Redistributions in binary form must reproduce the above |
13 // copyright notice, this list of conditions and the following disclaimer | 13 // copyright notice, this list of conditions and the following disclaimer |
14 // in the documentation and/or other materials provided with the | 14 // in the documentation and/or other materials provided with the |
15 // distribution. | 15 // distribution. |
16 // * Neither the name of Google Inc. nor the names of its | 16 // * Neither the name of Google Inc. nor the names of its |
17 // contributors may be used to endorse or promote products derived from | 17 // contributors may be used to endorse or promote products derived from |
18 // this software without specific prior written permission. | 18 // this software without specific prior written permission. |
19 // | 19 // |
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 |
31 #endregion | 32 #endregion |
32 | 33 |
33 namespace Google.Protobuf.Reflection | 34 using System; |
| 35 |
| 36 namespace Grpc.Core.Logging |
34 { | 37 { |
35 /// <summary> | 38 /// <summary> |
36 /// Enumeration of all the possible field types. | 39 /// Logger which doesn't log any information anywhere. |
37 /// </summary> | 40 /// </summary> |
38 public enum FieldType | 41 public sealed class NullLogger : ILogger |
39 { | 42 { |
40 /// <summary> | 43 /// <summary> |
41 /// The <c>double</c> field type. | 44 /// As with all logging calls on this logger, this method is a no-op. |
42 /// </summary> | 45 /// </summary> |
43 Double, | 46 public void Debug(string message) |
| 47 { |
| 48 } |
| 49 |
44 /// <summary> | 50 /// <summary> |
45 /// The <c>float</c> field type. | 51 /// As with all logging calls on this logger, this method is a no-op. |
46 /// </summary> | 52 /// </summary> |
47 Float, | 53 public void Debug(string format, params object[] formatArgs) |
| 54 { |
| 55 } |
| 56 |
48 /// <summary> | 57 /// <summary> |
49 /// The <c>int64</c> field type. | 58 /// As with all logging calls on this logger, this method is a no-op. |
50 /// </summary> | 59 /// </summary> |
51 Int64, | 60 public void Error(string message) |
| 61 { |
| 62 } |
| 63 |
52 /// <summary> | 64 /// <summary> |
53 /// The <c>uint64</c> field type. | 65 /// As with all logging calls on this logger, this method is a no-op. |
54 /// </summary> | 66 /// </summary> |
55 UInt64, | 67 public void Error(Exception exception, string message) |
| 68 { |
| 69 } |
| 70 |
56 /// <summary> | 71 /// <summary> |
57 /// The <c>int32</c> field type. | 72 /// As with all logging calls on this logger, this method is a no-op. |
58 /// </summary> | 73 /// </summary> |
59 Int32, | 74 public void Error(string format, params object[] formatArgs) |
| 75 { |
| 76 } |
| 77 |
60 /// <summary> | 78 /// <summary> |
61 /// The <c>fixed64</c> field type. | 79 /// Returns a reference to the instance on which the method is called, a
s |
| 80 /// instances aren't associated with specific types. |
62 /// </summary> | 81 /// </summary> |
63 Fixed64, | 82 public ILogger ForType<T>() |
| 83 { |
| 84 return this; |
| 85 } |
| 86 |
64 /// <summary> | 87 /// <summary> |
65 /// The <c>fixed32</c> field type. | 88 /// As with all logging calls on this logger, this method is a no-op. |
66 /// </summary> | 89 /// </summary> |
67 Fixed32, | 90 public void Info(string message) |
| 91 { |
| 92 } |
| 93 |
68 /// <summary> | 94 /// <summary> |
69 /// The <c>bool</c> field type. | 95 /// As with all logging calls on this logger, this method is a no-op. |
70 /// </summary> | 96 /// </summary> |
71 Bool, | 97 public void Info(string format, params object[] formatArgs) |
| 98 { |
| 99 } |
| 100 |
72 /// <summary> | 101 /// <summary> |
73 /// The <c>string</c> field type. | 102 /// As with all logging calls on this logger, this method is a no-op. |
74 /// </summary> | 103 /// </summary> |
75 String, | 104 public void Warning(string message) |
| 105 { |
| 106 } |
| 107 |
76 /// <summary> | 108 /// <summary> |
77 /// The field type used for groups (not supported in this implementation
). | 109 /// As with all logging calls on this logger, this method is a no-op. |
78 /// </summary> | 110 /// </summary> |
79 Group, | 111 public void Warning(Exception exception, string message) |
| 112 { |
| 113 } |
| 114 |
80 /// <summary> | 115 /// <summary> |
81 /// The field type used for message fields. | 116 /// As with all logging calls on this logger, this method is a no-op. |
82 /// </summary> | 117 /// </summary> |
83 Message, | 118 public void Warning(string format, params object[] formatArgs) |
84 /// <summary> | 119 { |
85 /// The <c>bytes</c> field type. | 120 } |
86 /// </summary> | |
87 Bytes, | |
88 /// <summary> | |
89 /// The <c>uint32</c> field type. | |
90 /// </summary> | |
91 UInt32, | |
92 /// <summary> | |
93 /// The <c>sfixed32</c> field type. | |
94 /// </summary> | |
95 SFixed32, | |
96 /// <summary> | |
97 /// The <c>sfixed64</c> field type. | |
98 /// </summary> | |
99 SFixed64, | |
100 /// <summary> | |
101 /// The <c>sint32</c> field type. | |
102 /// </summary> | |
103 SInt32, | |
104 /// <summary> | |
105 /// The <c>sint64</c> field type. | |
106 /// </summary> | |
107 SInt64, | |
108 /// <summary> | |
109 /// The field type used for enum fields. | |
110 /// </summary> | |
111 Enum | |
112 } | 121 } |
113 } | 122 } |
OLD | NEW |