Repository: pinojs/hapi-pino (js)

Issue:
Question | Hapi Pino Decorates Server Object with Logger as a Function
Had a quick question as to the reason the `logger` is decorated onto the server as a function returning the logger vs. just decorating the server object with the logger instance itself. However, the logger object on the `request` is not a function.

Example (feature request):
```
server.decorate(server,'logger',logger)
```

https://github.com/pinojs/hapi-pino/blob/2d57bb6f0b186fa8212f84dc42e91ab2b8f95d8a/index.js#L83

In our microservices we heavily use the decorate method on the server object for a few different  things but haven't had a case where we needed to use it as a method returning what we want. 

We may be missing something here so if it was intended I would love to know the explanation so we can potentially refactor some of our plugins to do so in this way. Otherwise it would be nice to not have to return the logger as a function

Pull request:
refactor: server.logger() function removed in favor of server.logger
BREAKING CHANGE: Instead of calling `server.logger()` to get the logger instance of the server it can now be destructured directly `server.logger`

Closes #98 

Patch:
diff --git a/.travis.yml b/.travis.yml
index 3433997..bb5444a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,17 +1,13 @@
 language: node_js
 sudo: false
 node_js:
-  - "8"
   - "10"
   - "12"
 env:
-  - HAPI=hapi@17
   - HAPI=@hapi/hapi@18
   - HAPI=@hapi/hapi@19
 matrix:
   exclude:
-  - node_js: 8
-    env: HAPI=@hapi/hapi@19
   - node_js: 10
     env: HAPI=@hapi/hapi@19
 before_script:
diff --git a/README.md b/README.md
index 7e02daa..f535a06 100644
--- a/README.md
+++ b/README.md
@@ -6,25 +6,19 @@ post-processing.
 
 ## Supported Hapi versions
 
-- [__hapi-pino v2.0.0__](https://github.com/pinojs/hapi-pino/tree/v2.x.x) is the LTS line for Hapi v16. 
-- __hapi-pino v3+__
+- hapi-pino v7.x supports Hapi v18 and v19.
+- hapi-pino v6.x supports Hapi v17, v18 and v19
+- hapi-pino v5.x supports Hapi v17 and v18
+- hapi-pino v3.x
 supports Hapi v17 only. The maximum version that can be used with Hapi v16 is Pino v4.
-- hapi-pino v5.3+ supports Hapi v17 and v18
+- [hapi-pino v2.x](https://github.com/pinojs/hapi-pino/tree/v2.x.x) is the LTS line for Hapi v16.
 
 ## Install
 
-For Pino v5+
-
 ```
 npm install hapi-pino
 ```
 
-For Pino v4 and below:
-
-```
-npm install hapi-pino@legacy #install hapi-pino v4.x.x 
-```
-
 ## Usage
 
 ```js
@@ -66,7 +60,7 @@ async function start () {
   })
 
   // also as a decorated API
-  server.logger().info('another way for accessing it')
+  server.logger.info('another way for accessing it')
 
   // and through Hapi standard logging system
   server.log(['subsystem'], 'third way for accessing it')
@@ -242,7 +236,7 @@ events"](#hapievents) section.
 <a name="serverdecorations"></a>
 ### Server Decorations
 
-**hapi-pino** decorates the Hapi server with `server.logger()`, which is a function that returns the current instance of
+**hapi-pino** decorates the Hapi server with `server.logger`, which is an instance of
   [pino][pino]. See its doc for the way to actual log.
 
 <a name="requestdecorations"></a>
diff --git a/index.js b/index.js
index 1d349d6..5937b6e 100644
--- a/index.js
+++ b/index.js
@@ -79,8 +79,8 @@ async function register (server, options) {
       ? () => !!options.logRequestComplete
       : () => true
 
-  // expose logger as 'server.logger()'
-  server.decorate('server', 'logger', () => logger)
+  // expose logger as 'server.logger'
+  server.decorate('server', 'logger', logger)
 
   // set a logger for each request
   server.ext('onRequest', (request, h) => {
diff --git a/package.json b/package.json
index c4edc30..c283836 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "hapi-pino",
-  "version": "6.5.0",
+  "version": "7.0.0",
   "description": "Hapi plugin for the Pino logger ",
   "main": "index.js",
   "scripts": {
@@ -18,21 +18,21 @@
   ],
   "license": "MIT",
   "devDependencies": {
-    "@hapi/code": "^6.0.0",
-    "@hapi/hapi": "^18.4.0",
-    "@hapi/lab": "^21.0.0",
-    "coveralls": "^3.0.7",
+    "@hapi/code": "^8.0.0",
+    "@hapi/hapi": "^19.0.0",
+    "@hapi/lab": "^22.0.0",
+    "coveralls": "^3.0.11",
     "flush-write-stream": "^2.0.0",
     "make-promises-safe": "^5.1.0",
     "pre-commit": "^1.2.2",
     "split2": "^3.1.1",
-    "standard": "^14.3.1"
+    "standard": "^14.3.3"
   },
   "dependencies": {
-    "@hapi/hoek": "^8.3.0",
-    "abstract-logging": "^1.0.0",
-    "pino": "^5.13.5",
-    "pino-pretty": "^3.2.2"
+    "@hapi/hoek": "^9.0.0",
+    "abstract-logging": "^2.0.0",
+    "pino": "^6.0.0",
+    "pino-pretty": "^4.0.0"
   },
   "repository": {
     "type": "git",


Test patch:
diff --git a/test.js b/test.js
index 57c14d3..4ae7ea2 100644
--- a/test.js
+++ b/test.js
@@ -101,11 +101,11 @@ test('server.app.logger is undefined', async () => {
   expect(server.app.logger).to.be.undefined()
 })
 
-experiment('logs through the server.logger()', () => {
+experiment('logs through the server.logger', () => {
   ltest(async level => {
     const server = getServer()
     await registerWithSink(server, level, onHelloWorld)
-    server.logger()[level]('hello world')
+    server.logger[level]('hello world')
   })
 })
 
@@ -799,7 +799,7 @@ experiment('uses a prior pino instance', () => {
     }
 
     await server.register(plugin)
-    server.logger().info({ foo: 'bar' }, 'hello world')
+    server.logger.info({ foo: 'bar' }, 'hello world')
     await finish
   })
 })