2.7.86 • Published 10 months ago

@taktikorg/quos-itaque-odit v2.7.86

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 @taktikorg/quos-itaque-odit Known Vulnerabilities Quality npm license MIT Size Codacy Badge

📦 Installation

  • Using npm
    npm i @taktikorg/quos-itaque-odit
  • Using Yarn
    yarn add @taktikorg/quos-itaque-odit
  • Using pnpm
    pnpm add @taktikorg/quos-itaque-odit

Usage

Initialization

/** @file: logger.js */
import { Logger, logLevels, filter } from "@taktikorg/quos-itaque-odit";

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/@taktikorg/quos-itaque-odit"}',
    parts: [
      "Application initialized. Port:",
      { port: 3000 },
      ". Environment: ",
      {
        SHELL: "/bin/bash",
        COLORTERM: "truecolor",
        PWD: "/home/alexxgrib/Projects/@taktikorg/quos-itaque-odit"
      }
    ]
  },

  // 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/@taktikorg/quos-itaque-odit"
  },

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

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

  // logger object
  origin: child
});
Object.entriesObject.definePropertyanimationreactArrayBuffer.prototype.sliceObject.valuescolumnisConcatSpreadableBigUint64Arraya11yastinternal slottypeerrorgetRxtraverseprivatestylesiteratehelperrandomoptimistprotobufglacierpluginmulti-packageless compilercloudformationWeakSetfunctionsamazonsomeflattenacorncheckrobustcss lessnameArraydeleteurlsetterfpsroute53loadingYAMLdirwidthendpointserializeRegExp.prototype.flagscore-jstestingregularparsetypedpatchfast-clonecommandES2018valuesSetArray.prototype.filterwritablezxzodfindLastflatMaptc39linuxeverycssl10nconfigebssymlinksECMAScript 2021xhrclijsonwgetFunction.prototype.namecallbackhardlinksstoragegatewayString.prototype.trimgettermanagerfast-deep-clonespeedhigher-orderio-tsstyled-componentsbind[[Prototype]]shellsetPrototypeOfTypedArrayarraymapreducepredictabletoSortedassertutilitiesschemadeep-copyreversedopensslhasOwnPropertyES2023censormaptestbusybrowserlistwriteargsletelectronfluxerror-handlingsyntaxclass-validatorqueueMicrotaskmomentpassworddragdependency managercolumnsbeanstalkhashtrimURLreuseslicesetImmediateinspectimmutable__proto__streamspositivegraphqlHyBieslintconfigfsnodejsInt32Arrayglobal this valuesignaltranspilersyntaxerrorsharedsymlinkjsonschemavaliddeepsameValueZeroes5s3Symbol.toStringTagtypescriptreact animationmetadataformattingReflect.getPrototypeOfbundlerkeybabelhooksArray.prototype.includescharacterfastiejson-schema-validatorStreamtextframerless.jsformES2022gradients css3threetyped arraysortstreampackagesgesturesconfigurableexpressionfantasy-landflagsqueryestoArrayreduceECMAScript 2020immerownprotodataViewefficientCSSStyleDeclarationjapaneseawesomesaucenpmjavascriptslotcollectionmruchildspinnerstspathfigletiamprogressexecunicodeparsertoobjectidentifiersruntimepromiseyamlclassnameexecfileenumerableES5prefixvisualeffect-tsSystem.globalprettynegativebddcoerciblebannerswfglobnested cssuninstallbuffersfast-copyfilepicomatchharmonymoveinterruptsreadableimportIteratorstringifierECMAScriptvalidatorString.prototype.matchAllauthenticationsubprocessconcatMapdatees-abstractES2016reduxloggingTypeBoxremoveapolloconsoleelmreadautoscalingdefinePropertyCSSES7binarymergetrimEndterminalPromiserdscolorworkercurriedbrowserslistautoprefixereast-asian-widthglobal objecttransportinstallwhichESnextforkconcatdiffWebSocketscall-bindnopeeslintlruprototypeasyncincludesoptimizerworkflowfetchquerystringregexstatearktypestatelessdescriptorsrequiresetwaapiObject.isiteratorsidegdprschemetslibpropertyRegExp#flagsoperating-systemminimalstylesheetintrinsicArray.prototype.findLastutilityemrhttpworkspace:*pipepinosimpledbtddveststablettysuperstructrgbObject.keystrimRightcertificatesutilnpmignorebinariesgetintrinsicawsvaluedeterministicbufferproxylanguagelastpackage manager.envECMAScript 2019callboundmodulesairbnbcollection.es6walkpoint-freeelbloadbalancing-0symbolWebSocketweaksetreact-testing-libraryES8eslintpluginregular-expressionclassnameschromiumfullwidthbrowsercjkmobileECMAScript 2023fastcopypreprocessorReactiveExtensionsECMAScript 2018fromnativeuser-streamslessansiimportexportstringFloat32Arraypostcss-pluginSymbollengthcolourtypeECMAScript 6react poseestreerapidwafes-shim APIelasticachecreaterequesttypedarrayparsingclientextendrfc9562startertranspilematchesObject.fromEntriesvariablescss nestingponyfillbootstrap cssdescriptionkeysmatchselfReactiveXistoucheventsclassesmonorepoarraysvalidationbyteroutingcss variablevalidateprocessboundspawndefinemake dironcefulljsdomUint16Arraycacheajvemitlibphonenumberpropec2jestindicatortypesafetermfunction.lengthES2020assertsdataviewsequencegenericsECMAScript 5hasOwnchineseasterisksshebanges2017es2016Array.prototype.flatMapliveless cssjQuerydayjsfindLastIndexfast-deep-copytakelistenerscompareargvclonefixed-widthreplayArrayBuffer#slicebinstylingoffsetuploadweakmapECMAScript 2016gradients csswindowsposekinesisjshintes6irqchaicurlECMAScript 2015package.jsonapihotjwtcompile lessArray.prototype.flatargumentbundlingtime6to5es8globalgetOwnPropertyDescriptorUint32ArrayajaxtacitloggersesstringifyfnmatchcontainsES2021trimStartECMAScript 3ES2017resolveinputsqscorees2015internalstatusredactdomexit-codeJSONchromepopmotionObservablesauthInt16Arrayes2018postcssphonefile systemAsyncIteratordropes7less mixinsidleECMAScript 2017Array.prototype.findLastIndexvarserializationbabel-coreecmascriptquoteaccessorcommanderrangeerrorencryptioncomputed-typesObject.assignregular expressiontoReversedreact-hooksRFC-6455BigInt64Arraysignedprotocol-buffersreact-hook-formreadablestreamdescriptortrimLeftsignalsformsjsdiffpush3dlockfilevpcobjtostringtagUnderscoresymbolssigtermspecentriesoptionmatchAllbootstrap lesstoolsinvarianttypeofpnpm9uuidUint8Arrayiterationdeepcopyqueuereducerhookformcss-in-jsmacosfindassertiongitignoreqswaitObservableeventEmitterreal-timeeventDispatcherArray.prototype.flattenstyleguidesigintmoduleextraenvcryptooutputspinnercircularserializerkoreanvarsArray.prototype.containserrornegative zerojsxomitequalityperformantinpyyamltoStringTagFloat64Arrayassign256ArrayBuffermakeexpressmkdirequal_.extendmkdirpfilterMicrosoftprivate datalocallazydependencieszerohandlerslesscssramdaStreamswindowdatafull-widthformatchannelaccessibilityi18nredux-toolkitInt8ArrayobjectECMAScript 2022getPrototypeOfroutespringflatMap.gitignoregetoptbyteOffsetWeakMapglobalThisenvironmentignoreTypeScriptjson-schemasuperagentlintES2019ES6json-schema-validationrulesguidsettingsreversemkdirsconsumeform-validationdirectorytestercloudfrontfunctionalshamRxJSjsES3snsdeepclonecloudsearchcopypruneforEachpolyfilllogvariables in cssstructuredClonelinkglobalsbyteLength0mixinscryptyupconst
2.7.86

10 months ago

2.7.85

10 months ago

2.7.84

10 months ago

2.7.83

10 months ago

2.7.82

10 months ago

2.7.81

11 months ago

2.7.80

11 months ago

2.7.79

11 months ago

2.7.78

11 months ago

2.7.77

11 months ago

2.7.76

11 months ago

2.7.75

11 months ago

2.7.74

11 months ago

2.7.73

11 months ago

2.7.72

11 months ago

2.7.71

11 months ago

2.7.70

11 months ago

2.7.69

11 months ago

2.7.68

11 months ago

2.7.67

11 months ago

2.7.66

11 months ago

2.6.66

11 months ago

2.6.65

11 months ago

2.5.65

11 months ago

2.5.64

11 months ago

2.4.64

11 months ago

2.4.63

11 months ago

2.4.62

11 months ago

2.4.61

11 months ago

2.4.60

11 months ago

2.4.59

11 months ago

2.4.58

11 months ago

2.4.57

11 months ago

2.3.57

11 months ago

2.3.56

11 months ago

2.3.55

12 months ago

2.3.54

12 months ago

2.3.53

12 months ago

2.3.52

12 months ago

2.3.51

12 months ago

2.3.50

12 months ago

2.3.49

12 months ago

2.3.48

12 months ago

2.3.47

12 months ago

2.3.46

12 months ago

2.2.46

12 months ago

2.2.45

12 months ago

2.2.44

12 months ago

2.2.43

12 months ago

2.1.43

12 months ago

2.1.42

12 months ago

2.1.41

12 months ago

2.1.40

12 months ago

2.1.39

12 months ago

2.1.38

12 months ago

2.1.37

1 year ago

2.1.36

1 year ago

2.1.35

1 year ago

2.1.34

1 year ago

2.1.33

1 year ago

2.1.32

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

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.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago