From 737f297afc7e26a3290636ad29b18047241ebede Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Tue, 7 Nov 2017 21:47:08 +0100 Subject: [PATCH] drop Monolog dependency from ClientBuilder --- .../Elasticsearch/ClientBuilder.asciidoc | 14 --------- docs/build/renderer.index | 2 +- docs/configuration.asciidoc | 29 +------------------ src/Elasticsearch/ClientBuilder.php | 14 --------- 4 files changed, 2 insertions(+), 57 deletions(-) diff --git a/docs/build/Elasticsearch/ClientBuilder.asciidoc b/docs/build/Elasticsearch/ClientBuilder.asciidoc index d8304cbe9..9f815e7e4 100644 --- a/docs/build/Elasticsearch/ClientBuilder.asciidoc +++ b/docs/build/Elasticsearch/ClientBuilder.asciidoc @@ -20,7 +20,6 @@ The class defines the following methods: * <> * <> * <> -* <> * <> * <> * <> @@ -157,19 +156,6 @@ corresponds to setConnectionPool(). -[[Elasticsearch_ClientBuilderdefaultLogger_defaultLogger]] -.`defaultLogger()` -**** -[source,php] ----- -/* -*/ - ----- -**** - - - [[Elasticsearch_ClientBuildersetConnectionFactory_setConnectionFactory]] .`setConnectionFactory()` **** diff --git a/docs/build/renderer.index b/docs/build/renderer.index index 64af672be..f10775586 100644 --- a/docs/build/renderer.index +++ b/docs/build/renderer.index @@ -1 +1 @@ -C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"6ac4061ad03df8cddeaec31a8bfb556fc7a33e71";s:27:"Elasticsearch\ClientBuilder";s:40:"30fa910e5653bf5f7096369ef1529a47da7e3e92";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file +C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"6ac4061ad03df8cddeaec31a8bfb556fc7a33e71";s:27:"Elasticsearch\ClientBuilder";s:40:"6b9f0fd58072ecaf8820c64a087b5ab03b2213d3";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index e159eee67..19845a27b 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -180,34 +180,7 @@ And then update your composer installation: php composer.phar update ---------------------------- -Once Monolog (or another logger) is installed, you need to create a log object and inject it into the client. The -`ClientBuilder` object has a helper static function that will generate a common Monolog-based logger for you. All you need -to do is provide the path to your desired logging location: - -[source,php] ----- -$logger = ClientBuilder::defaultLogger('path/to/your.log'); - -$client = ClientBuilder::create() // Instantiate a new ClientBuilder - ->setLogger($logger) // Set the logger with a default logger - ->build(); // Build the client object ----- - -You can also specify the severity of log messages that you wish to log: - -[source,php] ----- -// set severity with second parameter -$logger = ClientBuilder::defaultLogger('/path/to/logs/', Logger::INFO); - -$client = ClientBuilder::create() // Instantiate a new ClientBuilder - ->setLogger($logger) // Set the logger with a default logger - ->build(); // Build the client object ----- - -The `defaultLogger()` method is just a helper, you are not required to use it. You can create your own logger and inject -that instead: - +Once Monolog (or another logger) is installed, you need to create a log object and inject it into the client: [source,php] ---- diff --git a/src/Elasticsearch/ClientBuilder.php b/src/Elasticsearch/ClientBuilder.php index d26086a2a..e0a432df1 100644 --- a/src/Elasticsearch/ClientBuilder.php +++ b/src/Elasticsearch/ClientBuilder.php @@ -212,20 +212,6 @@ public static function singleHandler() } } - /** - * @param $path string - * @param int $level - * @return \Monolog\Logger\Logger - */ - public static function defaultLogger($path, $level = Logger::WARNING) - { - $log = new Logger('log'); - $handler = new StreamHandler($path, $level); - $log->pushHandler($handler); - - return $log; - } - /** * @param \Elasticsearch\Connections\ConnectionFactoryInterface $connectionFactory * @return $this