internal Graphite(
     ICakeLog log,
     GraphiteSettings settings,
     IGraphiteClient client
     )
 {
     _log      = log;
     _settings = settings;
     _client   = client;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="Graphite"/> class.
        /// </summary>
        /// <param name="log">Cake log instance.</param>
        /// <param name="settings"><see cref="GraphiteSettings"/> instance.</param>
        public Graphite(
            ICakeLog log,
            GraphiteSettings settings)
        {
            _log      = log;
            _settings = settings;

            _client = new GraphiteClientWrapper(new GraphiteClient(settings.Host)
            {
                HttpApiPort = settings.HttpApiPort,
                BatchSize   = settings.BatchSize,
                UseSsl      = settings.UseSsl,
            });
        }
        public static Graphite Graphite(this ICakeContext context, GraphiteSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (settings == null)
            {
                context.Log.Error("Calling Graphite() with GraphiteSettings being null throws an exception");
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrWhiteSpace(settings.Host))
            {
                context.Log.Error("GraphiteSettings.Host has to be a non-empty string");
                throw new ArgumentNullException(nameof(settings.Host));
            }

            AddinInformation.LogVersionInformation(context.Log);
            return(new Graphite(context.Log, settings));
        }
 internal static Graphite Graphite(this ICakeContext context, GraphiteSettings settings, IGraphiteClient graphiteClient)
 {
     return(new Graphite(context.Log, settings, graphiteClient));
 }