3.9.85 • Published 10 months ago

@erboladaiorg/quaerat-excepturi v3.9.85

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Tie Logger

👔 Fully typed minimal platform-agnostic logger

Test Status Downloads last commit codecov GitHub @erboladaiorg/quaerat-excepturi Known Vulnerabilities Quality npm license MIT Size Codacy Badge

📦 Installation

  • Using npm
    npm i @erboladaiorg/quaerat-excepturi
  • Using Yarn
    yarn add @erboladaiorg/quaerat-excepturi
  • Using pnpm
    pnpm add @erboladaiorg/quaerat-excepturi

Usage

Initialization

/** @file: logger.js */
import { Logger, logLevels, filter } from "@erboladaiorg/quaerat-excepturi";

export const logger = new Logger(
  "app", // Root logger name
  logLevels(), // Define log levels. By default are: verbose, debug, info, warn, error, fatal
  // You can use custom levels by using
  // logLevels("info", "warn", "error")

  {
    // Custom data
    appVersion: "3.1"
    moduleName: "root",
    moduleVersion: "1.0.0"
  }
);

export const child = logger.child(
  // Child logger name
  "auth",

  // Child logger data
  { moduleName: "auth", moduleVersion: "0.3.1" }
);

const criticalLogs = [];

const unsubscribe = logger.subscribe(
  // Subscribe to all logs, they go to console
  (log) => console.log(...log.message.parts),

  // All logs, that level is greater or equal than "warn" will be added to critical logs

  // Severity is determined by index of level in levels array
  // Current array is: verbose, debug, info, warn, error, fatal
  //                             [less] <<<  ^^^^   >> [greater]
  filter(">=", "warn", (log) => criticalLogs.push(log))
)

process.on("SIGINT", () => {
  unsubscribe();
})

Logging

/** @file: index.js */
import { child, logger } from "./logger.js";

const PORT = parseInt(process.env.PORT) || 3000;
logger.subscribe(log => console.log(log));

child.log.debug`Application initialized. Port: ${{ port: PORT }}. Environment: ${{process.env}}`;
// Level:  ^^^^^

// Here goes app

Log format

({
  // One of defined levels
  level: "debug",

  message: {
    template:
      "Application initialized. Port: {port}. Environment: {SHELL,COLORTERM,PWD}",
    plain:
      'Application initialized. Port: 3000. Environment: {"SHELL":"/bin/bash","COLORTERM":"truecolor","PWD":"/home/alexxgrib/Projects/@erboladaiorg/quaerat-excepturi"}',
    parts: [
      "Application initialized. Port:",
      { port: 3000 },
      ". Environment: ",
      {
        SHELL: "/bin/bash",
        COLORTERM: "truecolor",
        PWD: "/home/alexxgrib/Projects/@erboladaiorg/quaerat-excepturi"
      }
    ]
  },

  // merge of
  // - logger data
  // - logger parents data
  // - data passed in log message
  data: {
    appVersion: "3.1",
    moduleName: "auth",
    moduleVersion: "0.3.1",
    port: 3000,
    SHELL: "/bin/bash",
    COLORTERM: "truecolor",
    PWD: "/home/alexxgrib/Projects/@erboladaiorg/quaerat-excepturi"
  },

  context: {
    // name of the logger
    name: "auth",

    // list of logger inheritance
    path: ["app", "auth"]
  },

  // logger object
  origin: child
});
sortes-shimsa11ykoreantstestECMAScript 2023fast-clonetc39arktypeglobalsdayjsroute53jsonschemahassidevestajvoperating-systemhelpersreuseiamgraphqlString.prototype.matchAllcss nestingoptimizerequalfulljson-schema-validationsettersestrimStartregular-expressionregularfiletranspileforkargvregexhttpstateemrtraversesigintexecutevalidate__proto__nodegetterArray.prototype.containsnodejsES2019front-endairbnbdescriptorsentriesback-endSymbolerrorgetfpsfindLasteverycss-in-jswidthi18nmkdirpMapsequencefnmatchdependency managerramdaqsfastifystylepreprocessorES2021npmignorecollectionsomeweaksetlinkSymbol.toStringTagtakecreateObject.valuessliceterminalimportstyled-componentstoSortedtypedarrayapolloreplayinArrayBuffer#slicepostcss-pluginFloat64Arrayasyncdatereact-testing-librarybabelflagWebSocketscore-jsbrowserurljshintexecless.jsrgbUint8Arrayes6clonechaiencryptionefficientpackageselbbuffersbrowserslistHyBi3dtypeofproxyflatasterisksletrequiresloteventsschemechromiumdescriptioncloudformationproppersistentRxJSreactclass-validatorstringifyarraysstructuredCloneAsyncIteratortypanionsyntaxerrorserializerhasOwnrecursivenamecircularsimpledbmonorepoprefixxtermstatelesshas-ownrouteparseaccessoronceawesomesauceeventDispatcherformatcolumnbinwaitObject.entriesES2022reduxarraybufferawsobjectwhichString.prototype.trimESnextenumerableflatMaps3getintrinsiccopyshebangdefinePropertyECMAScript 3springansiprettydeletefunction.lengtheslint-pluginl10ncryptequalitymoveponyfillpathes7matcheshashsetImmediateimmutablePromisegradients cssshimes2017JSON-Schemamapreducedomoptionsyntaxconsumeec2safestreamsomitintrinsicdirdataviewmapmatchnested cssassignvariablesfigletECMAScript 2020asciiprocessvalidatorchromeeslintStreamjestkinesiswalkECMAScript 6animationnegativefindoutputloggerenvironmentReactiveXendpointcolorzodlinuxECMAScript 5serviceless mixinsstylingformcloudwatchbundlingArrayBufferrequestECMAScript 2022flagscloudfrontlintcharacternameskeysdatastructuretoStringTagjQueryopenssllogvpccall-boundObject.isfastcopysignalsYAMLloadbalancingdynamodbcontainsbrowserlistObjectpinohasOwnPropertyjwtgetPrototypeOfserverlockfilelibphonenumberwritableflattenenderenvironmentsnegative zerocompile lessObject.assignFloat32Arraybufferes2015joipnpm9rapidtypedarraysextendloggingboundreact-hooksreact animationfilterautoprefixerexitselffunctionpopmotiondeepcopyagentmulti-packageES2023callbindglacierbindInt32Arrayeffect-tsstreamfast-deep-copydeterministicrulesworkspace:*package.jsonInt8Arrayextradeep-copycomputed-typesaccessibilityprotobufjson-0ECMAScript 2016ObservablesES2020utilitiesamazonplugincomparetrimRightexecfilereal-timefromtoArrayclassnameinterruptsglobal objectECMAScript 2021mruSystem.globalstoragegatewaysymbolswfdeepclonelanguageexit-codelocalspecnopeES6utilityserializestableinternalCSSStyleDeclarationfshookformisConcatSpreadableviewcall-bindReactiveExtensionscallboundscheme-validationdropapipredictablefluxhandlerArray.prototype.findLastIndexuploadartWeakSetvalidationsameValueZeroECMAScript 2017setPrototypeOfmake dirquotemobilewafindicatores-abstractArrayBuffer.prototype.sliceremovewhatwgUint8ClampedArrayacornunicodefull-widthtoolstoobjectMicrosoftbeanstalkglobalThisfullwidthvalidchineseprivateES8tacitxhrpackage managerbootstrap lessajaxcloudtrailObject.keysstringifiertslibdependenciesRxsymlinkscompilersettingsCSSjson-schema-validatorObject.definePropertyshrinkwrapwarningwgetTypeBoxmkdirhandlersidleWebSockettddstarterescapehelperES2018es2016internal slotvisualdescriptorconfigwindowsruntimejavascriptvarsserializationmakeclientjsxexpressglobalclassnameselmtermArray.prototype.findLasttypesdeep-clonetelephonebinarydifffindLastIndexsetirqperformantcurlparserRegExp#flagses2018inferenceconcatMapredirectgdprsignaltypesafeimmertyped arraytrimEndcssdefinevalueslistenerspropertiesESyup.gitignoreecmascript$.extendsqspolyfillconstpasswordbyteOffsetcommand-linegroupfast-deep-cloneauthenticationbusyECMAScript 7ebshardlinksFunction.prototype.namesnsestreetestermodulezxposeBigInt64Arraydirectory_.extendttyregexpES7ES2015error-handlingmetadatalesscsshotelectronastwindowclipipelazyweakmapvaluecodes0routingbundlerthreetostringtagsharedprogressreact-componentlasttimehigher-orderisyamlUint32ArrayURLObject.fromEntriescoreES2016point-freetouchreadlocationreact-hook-formUint16Arrayjapanese[[Prototype]]utiles8arrayautoscalingcolorssuperagentownredux-toolkitcallsuperstructECMAScriptpositiveiteratorformselasticachetypeerrorinspectvariables in cssgitignoreeast-asian-widthutil.inspecteslintconfigcolourIteratorworkertypefastreadableprotocol-buffersES5stylesutilsglobtranspilercryptokeydeepbddshambyteLengthclassesArrayfixed-widthoptimistspinnersgetoptcommander
3.9.85

10 months ago

3.9.84

10 months ago

3.9.83

10 months ago

3.9.82

10 months ago

3.9.81

10 months ago

3.9.80

10 months ago

3.8.80

10 months ago

3.8.79

11 months ago

3.8.78

11 months ago

3.8.77

11 months ago

3.8.76

11 months ago

3.8.75

11 months ago

3.8.74

11 months ago

3.8.73

11 months ago

3.8.72

11 months ago

3.8.71

11 months ago

3.8.70

11 months ago

3.8.69

11 months ago

3.8.68

11 months ago

3.8.67

11 months ago

3.8.66

11 months ago

3.7.66

11 months ago

3.7.65

11 months ago

3.7.64

11 months ago

3.7.63

11 months ago

2.7.63

11 months ago

2.7.62

11 months ago

2.7.61

11 months ago

2.7.60

11 months ago

2.7.59

11 months ago

2.7.58

11 months ago

2.7.57

11 months ago

2.7.56

11 months ago

2.7.55

11 months ago

2.6.55

11 months ago

1.6.55

11 months ago

1.6.54

11 months ago

1.6.53

12 months ago

1.6.52

12 months ago

1.6.51

12 months ago

1.6.50

12 months ago

1.6.49

12 months ago

1.6.48

12 months ago

1.6.47

12 months ago

1.6.46

12 months ago

1.6.45

12 months ago

1.6.44

12 months ago

1.6.43

12 months ago

1.6.42

12 months ago

1.6.41

12 months ago

1.6.40

12 months ago

1.6.39

12 months ago

1.6.38

12 months ago

1.5.38

12 months ago

1.4.38

12 months ago

1.3.38

12 months ago

1.3.37

12 months ago

1.2.37

1 year ago

1.2.36

1 year ago

1.2.35

1 year ago

1.2.34

1 year ago

1.2.33

1 year ago

1.2.32

1 year ago

1.2.31

1 year ago

1.2.30

1 year ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.2.17

1 year ago

1.2.16

1 year ago

1.2.15

1 year ago

1.2.14

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.2.11

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago