diff --git a/README.md b/README.md index 9428ed4..ce594c3 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ A lightweight Node.js and TypeScript dependency injection framework powered [tsy ### Table of Contents - [Installation](#installation) - [Quick Start](#quick-start) +- [coreSettings](#coresettings) - [Decorators](#decorators) - [Controller()](#controller) - [Get(), Post(), Put(), Delete(), Head(), Patch(), Options()](#get-post-put-delete-head-patch-options) @@ -22,6 +23,7 @@ A lightweight Node.js and TypeScript dependency injection framework powered [tsy - [Events](#events) - [EndpointOptions](#endpointoptions) + ## Installation ```sh @@ -62,13 +64,16 @@ export default class ResponseModel { ```typescript // application.ts -import { Modules, PermissionModule, HandleErrorResponse, DataSource, dataSourceList, EventsModules } from "helocore"; +import { Modules, PermissionModule, HandleErrorResponse, DataSource, dataSourceList, EventsModules, coreSettings } from "helocore"; import TestController from './TestController' import PermissionControl from './PermissionControl' import Redis from './Redis' import ResponseModel from './ResponseModel' import EventsTest from './Events' +// default true +coreSettings.logger = false + // Controller layer defining Modules([ TestController @@ -118,6 +123,10 @@ fastify.register((app, _, done) => { fastify.listen({ port: 3000 }, () => console.log('API is Running')) ``` +## coreSettings + +- **logger**: helocore logger with trace_id to command prompt. it can reachable from `req.trace_id` + ## Decorators ### Controller() diff --git a/example/application.ts b/example/application.ts index 46b9cec..51c7c01 100644 --- a/example/application.ts +++ b/example/application.ts @@ -1,4 +1,4 @@ -import { HandleErrorResponse, Modules, EventsModule } from "helocore" +import { HandleErrorResponse, Modules, EventsModule, coreSettings } from "helocore" import UploadController from "./src/controllers/UploadController" import EventController from "./src/controllers/EventController" @@ -6,6 +6,8 @@ import ServiceResponse from "./src/models/ServiceResponse" import { handleError } from "./src/modules/HandleError" import EventTest from "./src/events/Events" +coreSettings.logger = true + Modules([ UploadController, EventController diff --git a/src/Settings.ts b/src/Settings.ts index 6a38e1d..e3aeb9e 100644 --- a/src/Settings.ts +++ b/src/Settings.ts @@ -3,5 +3,8 @@ export const coreSettings: TSettings = { } type TSettings = { + /** + * Default true + */ logger: boolean } \ No newline at end of file