| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | namespace Ice; |
| | 4 | |
|
| | 5 | | /// <summary> |
| | 6 | | /// Class to support custom loggers. Applications using a custom logger |
| | 7 | | /// instantiate a LoggerPlugin with a custom logger and |
| | 8 | | /// return the instance from their PluginFactory implementation. |
| | 9 | | /// </summary> |
| | 10 | | public class LoggerPlugin : Plugin |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Initializes a new instance of the <see cref="LoggerPlugin" /> class. This constructor installs a custom |
| | 14 | | /// logger to the given communicator. |
| | 15 | | /// </summary> |
| | 16 | | /// <param name="communicator">The communicator using the custom logger.</param> |
| | 17 | | /// <param name="logger">The custom logger for the communicator.</param> |
| 0 | 18 | | public |
| 0 | 19 | | LoggerPlugin(Communicator communicator, Logger logger) |
| | 20 | | { |
| 0 | 21 | | if (communicator == null) |
| | 22 | | { |
| 0 | 23 | | throw new PluginInitializationException("Communicator cannot be null."); |
| | 24 | | } |
| | 25 | |
|
| 0 | 26 | | if (logger == null) |
| | 27 | | { |
| 0 | 28 | | throw new PluginInitializationException("Logger cannot be null."); |
| | 29 | | } |
| | 30 | |
|
| 0 | 31 | | Ice.Internal.Instance instance = communicator.instance; |
| 0 | 32 | | instance.setLogger(logger); |
| 0 | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Called by the Ice run time during communicator initialization. The derived class |
| | 37 | | /// can override this method to perform any initialization that might be required |
| | 38 | | /// by a custom logger. |
| | 39 | | /// </summary> |
| | 40 | | public void |
| | 41 | | initialize() |
| | 42 | | { |
| 0 | 43 | | } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Called by the Ice run time when the communicator is destroyed. The derived class |
| | 47 | | /// can override this method to perform any finalization that might be required |
| | 48 | | /// by a custom logger. |
| | 49 | | /// </summary> |
| | 50 | | public void |
| | 51 | | destroy() |
| | 52 | | { |
| 0 | 53 | | } |
| | 54 | | } |