1 #region Copyright notice and license 2 3 // Copyright 2016 gRPC authors. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 17 #endregion 18 19 using System; 20 21 namespace Grpc.Core.Logging 22 { 23 /// <summary> 24 /// Logger which doesn't log any information anywhere. 25 /// </summary> 26 public sealed class NullLogger : ILogger 27 { 28 /// <summary> 29 /// As with all logging calls on this logger, this method is a no-op. 30 /// </summary> Debug(string message)31 public void Debug(string message) 32 { 33 } 34 35 /// <summary> 36 /// As with all logging calls on this logger, this method is a no-op. 37 /// </summary> Debug(string format, params object[] formatArgs)38 public void Debug(string format, params object[] formatArgs) 39 { 40 } 41 42 /// <summary> 43 /// As with all logging calls on this logger, this method is a no-op. 44 /// </summary> Error(string message)45 public void Error(string message) 46 { 47 } 48 49 /// <summary> 50 /// As with all logging calls on this logger, this method is a no-op. 51 /// </summary> Error(Exception exception, string message)52 public void Error(Exception exception, string message) 53 { 54 } 55 56 /// <summary> 57 /// As with all logging calls on this logger, this method is a no-op. 58 /// </summary> Error(string format, params object[] formatArgs)59 public void Error(string format, params object[] formatArgs) 60 { 61 } 62 63 /// <summary> 64 /// Returns a reference to the instance on which the method is called, as 65 /// instances aren't associated with specific types. 66 /// </summary> ForType()67 public ILogger ForType<T>() 68 { 69 return this; 70 } 71 72 /// <summary> 73 /// As with all logging calls on this logger, this method is a no-op. 74 /// </summary> Info(string message)75 public void Info(string message) 76 { 77 } 78 79 /// <summary> 80 /// As with all logging calls on this logger, this method is a no-op. 81 /// </summary> Info(string format, params object[] formatArgs)82 public void Info(string format, params object[] formatArgs) 83 { 84 } 85 86 /// <summary> 87 /// As with all logging calls on this logger, this method is a no-op. 88 /// </summary> Warning(string message)89 public void Warning(string message) 90 { 91 } 92 93 /// <summary> 94 /// As with all logging calls on this logger, this method is a no-op. 95 /// </summary> Warning(Exception exception, string message)96 public void Warning(Exception exception, string message) 97 { 98 } 99 100 /// <summary> 101 /// As with all logging calls on this logger, this method is a no-op. 102 /// </summary> Warning(string format, params object[] formatArgs)103 public void Warning(string format, params object[] formatArgs) 104 { 105 } 106 } 107 } 108