2.10.85 • Published 10 months ago

@erboladaiorg/voluptatum-quasi v2.10.85

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

TypeScript Logging

TypeScript logging can be used to add logging to your web or node project.

Version 2 of @erboladaiorg/voluptatum-quasi has been written from scratch and is not compatible with version 1 (see migration).

There are two different flavors available to use. Please visit the documentation of the links below and pick the one you prefer.

Node Channel (NEW)

Supports logging to files and file rollover. Please see @erboladaiorg/voluptatum-quasi-node-channel for details.

Documentation

The following sections are available:

Using @erboladaiorg/voluptatum-quasi version 1?

Please visit https://github.com/erboladaiorg/voluptatum-quasi/tree/release-1.x for more details. Consider upgrading to the latest version.

Version 2 of @erboladaiorg/voluptatum-quasi is not compatible with version 1

Please check the migration guide for more information.

Getting started

For all details and documentation please visit the links above. The following sections provide a quick start only for both flavors.

Category style flavor

To install the category-style flavor use the following npm commands:

npm install --save @erboladaiorg/voluptatum-quasi  # Core is required for any style
npm install --save @erboladaiorg/voluptatum-quasi-category-style

Usage

The following section configures a provider and exposes a getLogger function for other modules to use. The getLogger in this example is used to create root categories.

/*--- LogConfig.ts ---*/
import {CategoryProvider, Category} from "@erboladaiorg/voluptatum-quasi-category-style";

const provider = CategoryProvider.createProvider("ExampleProvider");

export function getLogger(name: string): Category {
  return provider.getCategory(name);
}

/*--- Person.ts ---*/
import {getLogger} from "./LogConfig";

/* Root categories can and probably will be defined elsewhere, this is just an example */
const logModel = getLogger("model");

/* Create child categories based on a parent category, effectively allowing you to create a tree of loggers when needed */
const logPerson = logModel.getChildCategory("Person");

function example(value: string) {
  logPerson.debug(() => `Example function called with value ${value}`);
  try {
    // Awesome code here...
    logPerson.getChildCategory("example()").debug(() => "Child category again");
  }
  catch (e) {
    logPerson.error(() => "Awesome code failed unexpectedly", e);
  }
  finally {
    logPerson.debug(() => "Example function completed");
  }
}

Log4ts flavor

To install the log4ts-style flavor use the following npm commands:

npm install --save @erboladaiorg/voluptatum-quasi  # Core is required for any style
npm install --save @erboladaiorg/voluptatum-quasi-log4ts-style

Usage

The following section configures a provider and exposes a getLogger function for other modules to use.

/*--- LogConfig.ts ---*/
import {LogLevel} from "@erboladaiorg/voluptatum-quasi";
import {Log4TSProvider, Logger} from "@erboladaiorg/voluptatum-quasi-log4ts-style";

const provider = Log4TSProvider.createProvider("ExampleProvider", {
  /* Specify the various group expressions to match against */
  groups: [{
    expression: new RegExp("model.+"),
    level: LogLevel.Debug, /* This group will log on debug instead */
  }, {
    expression: new RegExp("service.+"),
  }],
});

export function getLogger(name: string): Logger {
  return provider.getLogger(name);
}

/*--- Person.ts ---*/
import {getLogger} from "./LogConfig";

const log = getLogger("model.Person")

function example(value: string) {
  log.debug(() => `Example function called with value ${value}`);
  try {
    // Awesome code here...
  }
  catch (e) {
    log.error(() => "Awesome code failed unexpectedly", e);
  }
  finally {
    log.debug(() => "Example function completed");
  }
}

Build

Please make sure to have node 18 LTS installed.

To locally build the logging flavors. The easiest is to run the ./initialize.sh script:

./initialize.sh # Clean, install and build everything.

This will cleanly install and build your branch from scratch.

You can also manually install things, by going into the respective directories and manually type:

# If not installed yet
npm run ci
# or for the test projects
npm install

Any project when you're in the respective directory can be built with:

npm run build

That will clean, build and test the project.

Tests

To locally run the tests, in the respective directories:

npm run test

Integration tests

If you're on linux or mac-os, it's easiest to run initialize.sh first. Otherwise, skip that and run npm run install manually as shown below.

# Linux/MacOS only - Cleans everything and re-installs packages, including those for the integration projects.
./initialize.sh

# If not using ./initialize.sh, note that the dependent projects must be built first (core and the various styles, see above)
npm run install # Run inside respective test-integration project, e.g. tests-integration/rollup
npm run build   # Run inside respective test-integration project. Builds test webapp and runs cypress tests.

Bugs

If you encounter a bug please log it in the issue tracker of this repository and make sure to specify what flavor (style) you are using.

Contributing

Feel free to contribute or come up with great ideas, please use the issue tracker for that.

If you add/change new functionality and want it merged in a later release, please open a pull request. Also add tests for it (see various "test" directories).

Please keep in mind that things may not fit the library and in such case will be rejected, so if you are unsure please ask first before wasting your valuable time.

Migration

Please check the migration guide if you are on an old version and wish to use the latest version available.

Changelog

Please check the changelog

javascriptstatelessconcatMaptestES2023arraysstableECMAScript 2018sharedpreprocessordatastructurereal-timehandlersqsCSSnamefunction.lengthless.jscreategetOwnPropertyDescriptorcircularec2eventspredictableECMAScript 7mkdirsreact-hook-formpropertiesprettywgetbyteLengthString.prototype.matchAllhttplocalschemereadharmonyStreamfast-clonegroupBymonorepophoneURLcurlfunctionales-shimsslotpnpm9utilsxhrkeyRxJSform-validationformatmacosfigletcontainsrobusttoolkiteslint-pluginRegExp.prototype.flagspurebufferzodES6eslintpluginWebSocketpolyfillawsisvalidatetoobjectfluxinvariantassertionpushcommand-linextermSystem.globalfunctionsshebangcachePromisehookses8pathelectronbinariesArrayBuffer#slicelazyincludessetterlogtypedarrayfiletostringtagsubprocesssequencekoreandependency managernpmSymbolstarterviewWebSocketsUint32ArrayarktypefastifycallbindbyteOffsetfetchpersistentmockinggradients css3toArrayextendoperating-systemless cssescapeback-endreact-hooksmatchAllreactsuperstructmanagerpicomatchES3gradients cssBigUint64Arraypatchtermrequireestreevarscall-bindvarindicatorString.prototype.trimyupclassnamesstreamdefineemithookformtoolstouchclisyntaxebsfastcloneURLSearchParamstrimes7ECMAScript 2020metadataiamES5variablesfiltercurriedecmascriptimportexportintrinsicvalidreusehashRFC-6455hasa11yroutereact-testing-librarymatchesObject.entriesbinsignedrulesutilitiesairbnbshimawesomesaucedirfast-deep-copyfpssimpledbrgbsameValueZerogettertslibdotenvrangeerrors3reducemomentlinuxflattenformsjson-schemacheckflagsassertconfighasOwnPropertytesterlastJSONpositiveArray.prototype.flatten__proto__has-owndeep-copyshrinkwrapcompile lessworkspace:*utilityYAMLwriteiterationObject.getPrototypeOfexecutemulti-packagetypeerroruser-streamssymlinkFloat64ArrayspecTypeScriptasyncmixinsdraghelpersmapreducetoSortedserializerTypeBoxdependenciesprotobufreact-componenthttpsUint16Arraycss variableESnextArrayisConcatSpreadableshellroutingcss nestingsettingsECMAScript 2017ES2016autoscalingsymlinkskeysdomcryptjshintmodulescomparesigintgloblessworkflowdeepclonedynamodbenvironmentsqueueMicrotaskquoteramdamockdropletcall-boundmakeastgetPrototypeOfieassignaccessorwhatwgprefixclonebcryptECMAScript 2021RegExp#flagsreact animationresolvereducersymbolsprogressi18nPushObject.issetImmediatestyled-componentsencryptiondefinePropertyzxvpcjsdifftddimportterminalsetPrototypeOfpreserve-symlinksfindtrimEndauthenticationregexpfnmatchvaluesstyleguidebannerArray.prototype.findLastimmercryptoidlesharedarraybufferbundlingurlfull-widthbootstrap less$.extendframerbusyObservable[[Prototype]]execfilechannelsesdescriptorclassesacorncjkswflivenodequerystringpostcss-plugininferencecloudwatchenumerablefppluginregular expressionidentifiersrapidprotoschemaextraless compiler3dstringifyarraybufferinternallintzeroagentrdsboundasciihasOwndayjsmkdirprivateoptimizershamuploadfastArray.prototype.flatMapdiffsyntaxerrorbundlerlistenersfast-copyformattingglobalMaptc39queueargumentsafecoercibleauthpipeesdescriptorsartmobilelanguageutil.inspectgetoptelasticachejestECMAScript 2016three@@toStringTagserializationespreetranspilerloadbalancinges2017censorreadablestreamcloudfrontcloudsearchES2018equallinkSetsortedomitcodesproptestingdatetraversebindlesscssInt16ArraysignalsstoragegatewayObject.keysequalityObservablesconsumepackage.jsonentriesreact posereadablenumbernamesmodulebootstrap csshelperdeleteInt8Arrayeast-asian-widthrequestcopyeslintutilSymbol.toStringTagglacierfullwidthremovejoieveryrecursivecallbacktypeofbabel-coreformES2017stylesheetsortoptionamazondataviewruntimecallboundclass-validatorinterruptsregularchaigenericsArray.prototype.filternegative zerojsdomrandomtoStringTagspeedcertificateslocationio-tsnpmignorecommandwindowsbufferscolorstypedchildbeanstalknested csspopmotionUint8ClampedArrayservicefromselfchromiumexitinternal slotes5jsbyteserverinspectjson-schema-validationdeepjQuerydatahandlerArrayBuffer.prototype.slicefulltypeses2018Int32Arraytimejapanesevestreduxasterisksenderes-shim APIpostcssconstpoint-freettycompilerObject.assignECMAScript 2015findLastglobalsWeakMapsnssuperagentvalidationnegativetacitwarninges2016mergepropertycoreprivate datagraphqlignoreAsyncIteratorvariables in cssfindLastIndexfunctionl10ncolumnspassworditerate_.extendparsepruneenviteratorirqstructuredClonestylefast-deep-clonevalueunicode256collection0weakmapprotocol-buffersconfigurabledataViewtelephonecolumnbrowserslistReflect.getPrototypeOfjsonschematranspiletsBigInt64Arraycloudformationredactlengthsqsroute53ECMAScript 2019outputspinnerIteratorECMAScript 5typanionredux-toolkitautoprefixerhigher-orderFunction.prototype.nameeventEmitterObjecttrimRightspawneffect-tsloggerstreamslruFloat32Arraygetintrinsicobject6to5hardlinksmrugitignorechinesebrowserlisttransportnopeES2020endpointMicrosoftposeES7Uint8Arraybabelgesturesdirectorystatusansiwidthclientinputoffsetopenssllibphonenumbervisuales-abstractapicharactersomefront-endmake dirdeepcopytyped arrayCSSStyleDeclarationforkjwtES8stylesjson-schema-validatorTypedArrayelmcss lessslicewaitperformanceloggingwafquerysetefficientloadingArray.prototype.flatECMAScript 6gdprfile systempyyamlchromecomputed-typesspinnerscommandermatchJSON-Schemaclassnamenodejspackage manageroptimistObject.definePropertyminimales6replayemrbinarytypesafeoncenativefsyamlwalkES.gitignoreredirectstringsignalmovestringifierfantasy-landWeakSetjsonwindowcolorregexmkdirpfastcopyperformantexpressionponyfillArray.prototype.containsmapapolloRxargsparserkinesisStyleSheetwaapi-0eventDispatcherajaxinstallergrouppinoargvstateowninfixed-widthglobalThisarraytypescriptexeccollection.es6sideprocesshotwritableanimationspringcssworkerconcatES2021css-in-jsserializeuninstallcolourflatMapECMAScripttrimStartECMAScript 2022global this valuebddwhich
2.10.85

10 months ago

2.10.84

10 months ago

2.10.83

10 months ago

2.10.82

10 months ago

2.10.81

10 months ago

2.10.80

11 months ago

2.10.79

11 months ago

2.10.78

11 months ago

2.10.77

11 months ago

2.10.76

11 months ago

2.10.75

11 months ago

2.10.74

11 months ago

2.10.73

11 months ago

2.10.72

11 months ago

2.10.71

11 months ago

2.10.70

11 months ago

2.10.69

11 months ago

2.10.68

11 months ago

2.10.67

11 months ago

2.10.66

11 months ago

2.10.65

11 months ago

2.9.65

11 months ago

2.8.65

11 months ago

2.8.64

11 months ago

2.8.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.7.54

11 months ago

2.7.53

12 months ago

2.7.52

12 months ago

2.7.51

12 months ago

2.7.50

12 months ago

2.7.49

12 months ago

2.7.48

12 months ago

2.7.47

12 months ago

2.7.46

12 months ago

2.7.45

12 months ago

2.7.44

12 months ago

2.7.43

12 months ago

2.7.42

12 months ago

2.6.42

12 months ago

2.6.41

12 months ago

2.6.40

12 months ago

2.6.39

12 months ago

2.6.38

12 months ago

2.6.37

12 months ago

2.6.36

12 months ago

2.6.35

12 months ago

2.6.34

1 year ago

2.6.33

1 year ago

2.6.32

1 year ago

2.6.31

1 year ago

2.6.30

1 year ago

2.6.29

1 year ago

2.6.28

1 year ago

2.6.27

1 year ago

2.6.26

1 year ago

2.6.25

1 year ago

2.6.24

1 year ago

2.6.23

1 year ago

1.6.23

1 year ago

1.6.22

1 year ago

1.6.21

1 year ago

1.6.20

1 year ago

1.6.19

1 year ago

1.6.18

1 year ago

1.6.17

1 year ago

1.6.16

1 year ago

1.6.15

1 year ago

1.5.15

1 year ago

1.5.14

1 year ago

1.5.13

1 year ago

1.5.12

1 year ago

1.5.11

1 year ago

1.5.10

1 year ago

1.5.9

1 year ago

1.4.9

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

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

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago