4.10.96 • Published 12 months ago

@patrtorg/porro-similique-blanditiis v4.10.96

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

Tie Logger

👔 Fully typed minimal platform-agnostic logger

Test Status Downloads last commit codecov GitHub @patrtorg/porro-similique-blanditiis Known Vulnerabilities Quality npm license MIT Size Codacy Badge

📦 Installation

  • Using npm
    npm i @patrtorg/porro-similique-blanditiis
  • Using Yarn
    yarn add @patrtorg/porro-similique-blanditiis
  • Using pnpm
    pnpm add @patrtorg/porro-similique-blanditiis

Usage

Initialization

/** @file: logger.js */
import { Logger, logLevels, filter } from "@patrtorg/porro-similique-blanditiis";

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

  // 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/@patrtorg/porro-similique-blanditiis"
  },

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

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

  // logger object
  origin: child
});
awsform-validationramdacommandfunctionsArray.prototype.flatpurestreamsfpsdeepcopyconsumebootstrap lessInt16Arraychainopesettings0metadataloadings3System.globalutilsisprotocol-buffersglobalThisschemafullinstallgdprtrimEndrgbstatustsbannerReflect.getPrototypeOfTypeScriptreact-componentArrayoncespinnercompile lessdirectoryglacierrulesexitfpkeyreal-timeoptimizerutilequalityframerES3clonecolumnsymlinktimebabelfastcopy3dreverseglobcacheasciireact poseconcatMapfixed-widthreduceObject.entriessharedacornroute53envECMAScriptregular expressiontranspilecryptchannelglobal objectperformancetouchStreamsreduxcompilerdescriptionlocalObject.assignserializationUint8Arraycommanderpostcss-pluginimportexportsequencerapidgenericssetterflatMapclientswfmatchvalidationbindSymbol.toStringTagnpmdeep-clonesyntaxerroriteratorvalidreadablestreamuuidelmdragregularassertsfunctionReactiveXhttpjshintyuptypesafecopyPushreusemakeECMAScript 2019stylingargvurlECMAScript 6byteLengthfast-copysymbolvpcdatebrowserlistsaferfc9562awesomesauceloadbalancingresolve256MapimportarrayESnextdependenciestrimStartutil.inspectmacosroutingdefinebytedeletetslibnamesCSSStyleDeclarationregular-expressionintrinsicFunction.prototype.namebyteOffsetstructuredCloneRegExp.prototype.flagswhatwgmergeES2022superstructObjectvariables in csstypeerrorfastifyperformantstreamlazyelasticachecloudtrailsyntaxassigncsstoolsfilterArray.prototype.findLastIndextrimelectronUint32ArraytoolkitRegExp#flagsreadArrayBuffer.prototype.sliceajaxcodesserializebundlingdirBigInt64Arraymatchesspringjsonobjremoveless compileres5mapmanagerlistenerscss-in-jsreversedES2017numberfastcloneeventsmulti-packagees8vestgradients css3classnamedynamodbpruneposeenumerablegroupBychildgetponyfilltransportnpmignoremodulesphonebootstrap csscallboundtranspilerthreegetoptpoint-freeWeakSetindicatorObject.definePropertyqueryeventDispatchercertificateslastString.prototype.trimreact-hook-formbrowserTypedArrayWeakMapfrompreprocessorreplaytypedarraysinttyfileprefixproxyes-shimszerocolorsUint16ArrayhttpsESredactprogressIterator_.extendterminalgetintrinsicjson-schema-validationconfigdomsorteddescriptorsmonorepocss variablelinkexpressionsuperagentparsertypescripthardlinksInt32Arraynegativecloudsearchexecutecomputed-typesbufferArrayBuffer#slicefluxcolourjwtwgetcensorpushstringifierregexparktypesubprocessprettyenvironmentsquoteemit
4.10.95

1 year ago

4.10.96

12 months ago

4.10.94

1 year ago

4.10.93

1 year ago

4.10.92

1 year ago

4.10.91

1 year ago

4.10.90

1 year ago

4.10.89

1 year ago

4.10.88

1 year ago

4.10.87

1 year ago

4.10.86

1 year ago

4.10.85

1 year ago

4.10.84

1 year ago

3.10.84

1 year ago

3.10.83

1 year ago

3.9.83

1 year ago

3.9.82

1 year ago

3.9.81

1 year ago

3.9.80

1 year ago

3.9.79

1 year ago

3.9.78

1 year ago

3.9.77

1 year ago

3.9.76

1 year ago

3.9.75

1 year ago

3.9.74

1 year ago

3.9.73

1 year ago

3.9.72

1 year ago

3.9.71

1 year ago

3.9.70

1 year ago

3.9.69

1 year ago

3.9.68

1 year ago

3.9.67

1 year ago

3.8.67

1 year ago

3.8.66

1 year ago

3.8.65

1 year ago

3.8.64

1 year ago

3.8.63

1 year ago

3.8.62

1 year ago

3.8.61

1 year ago

3.8.60

1 year ago

3.8.59

1 year ago

3.8.58

1 year ago

3.8.57

1 year ago

3.8.56

1 year ago

3.8.55

1 year ago

3.8.54

1 year ago

3.8.53

1 year ago

3.8.52

1 year ago

3.8.51

1 year ago

3.8.50

1 year ago

3.7.50

1 year ago

3.7.49

1 year ago

3.7.48

1 year ago

2.7.48

1 year ago

2.6.48

1 year ago

2.6.47

1 year ago

2.6.46

1 year ago

2.6.45

1 year ago

2.6.44

1 year ago

2.6.43

1 year ago

2.6.42

1 year ago

2.6.41

1 year ago

2.6.40

1 year ago

2.6.39

1 year ago

2.6.38

1 year ago

2.6.37

1 year ago

2.6.36

1 year ago

2.6.35

1 year ago

2.6.34

1 year ago

2.5.34

1 year ago

2.5.33

1 year ago

2.5.32

1 year ago

2.5.31

1 year ago

2.5.30

1 year ago

2.5.29

1 year ago

2.5.28

1 year ago

2.4.28

1 year ago

2.3.28

1 year ago

2.3.27

1 year ago

2.3.26

1 year ago

2.3.25

1 year ago

2.3.24

1 year ago

2.3.23

1 year ago

2.3.22

1 year ago

2.3.21

1 year ago

2.3.20

1 year ago

2.3.19

1 year ago

2.2.19

1 year ago

2.2.18

1 year ago

2.2.17

1 year ago

2.2.16

1 year ago

2.2.15

1 year ago

2.2.14

1 year ago

2.2.13

1 year ago

2.2.12

1 year ago

2.2.11

1 year ago

2.2.10

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

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