fastify-txstate 3.0.5 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -3,11 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FailedValidationError = exports.HttpError = void 0;
6
+ exports.FailedValidationError = exports.HttpError = exports.devLogger = void 0;
7
7
  const fastify_1 = require("fastify");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const http_1 = __importDefault(require("http"));
10
10
  const http_status_codes_1 = require("http-status-codes");
11
+ exports.devLogger = {
12
+ level: 'info',
13
+ info: console.info,
14
+ error: console.error,
15
+ debug: console.debug,
16
+ fatal: console.error,
17
+ warn: console.warn,
18
+ trace: console.trace,
19
+ silent: (msg) => { },
20
+ child(bindings, options) { return exports.devLogger; }
21
+ };
11
22
  class Server {
12
23
  constructor(config = {}) {
13
24
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -35,10 +46,9 @@ class Server {
35
46
  delete config.https;
36
47
  }
37
48
  if (typeof config.logger === 'undefined') {
38
- config.logger = {
39
- level: 'info',
40
- prettyPrint: process.env.NODE_ENV === 'development'
41
- };
49
+ config.logger = process.env.NODE_ENV === 'development'
50
+ ? exports.devLogger
51
+ : { level: 'info' };
42
52
  }
43
53
  if (process.env.TRUST_PROXY)
44
54
  config.trustProxy = true;
@@ -10,6 +10,35 @@ export interface FastifyTxStateOptions extends Partial<FastifyServerOptions> {
10
10
  skipOriginCheck?: boolean;
11
11
  checkOrigin?: (req: FastifyRequest) => boolean;
12
12
  }
13
+ export declare const devLogger: {
14
+ level: string;
15
+ info: {
16
+ (...data: any[]): void;
17
+ (message?: any, ...optionalParams: any[]): void;
18
+ };
19
+ error: {
20
+ (...data: any[]): void;
21
+ (message?: any, ...optionalParams: any[]): void;
22
+ };
23
+ debug: {
24
+ (...data: any[]): void;
25
+ (message?: any, ...optionalParams: any[]): void;
26
+ };
27
+ fatal: {
28
+ (...data: any[]): void;
29
+ (message?: any, ...optionalParams: any[]): void;
30
+ };
31
+ warn: {
32
+ (...data: any[]): void;
33
+ (message?: any, ...optionalParams: any[]): void;
34
+ };
35
+ trace: {
36
+ (...data: any[]): void;
37
+ (message?: any, ...optionalParams: any[]): void;
38
+ };
39
+ silent: (msg: any) => void;
40
+ child(bindings: any, options?: any): any;
41
+ };
13
42
  export default class Server {
14
43
  protected https: boolean;
15
44
  protected errorHandlers: ErrorHandler[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "A small wrapper for fastify providing a set of common conventions & utility functions we use.",
5
5
  "exports": {
6
6
  "types": "./lib-esm/index.d.ts",