6.6.113 • Published 10 months ago

@diotoborg/aliquam-ut v6.6.113

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 @diotoborg/aliquam-ut 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 @diotoborg/aliquam-ut-node-channel for details.

Documentation

The following sections are available:

Using @diotoborg/aliquam-ut version 1?

Please visit https://github.com/diotoborg/aliquam-ut/tree/release-1.x for more details. Consider upgrading to the latest version.

Version 2 of @diotoborg/aliquam-ut 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 @diotoborg/aliquam-ut  # Core is required for any style
npm install --save @diotoborg/aliquam-ut-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 "@diotoborg/aliquam-ut-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 @diotoborg/aliquam-ut  # Core is required for any style
npm install --save @diotoborg/aliquam-ut-log4ts-style

Usage

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

/*--- LogConfig.ts ---*/
import {LogLevel} from "@diotoborg/aliquam-ut";
import {Log4TSProvider, Logger} from "@diotoborg/aliquam-ut-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

formattingswftouchArray.prototype.flatMapfindisregular expressiontoolsdirectoryCSSStyleDeclarationsortedparserimportexportbundleruninstallproxydebughasOwnPropertypostcss-pluginlanguageECMAScript 2020trimLefthashes6lrutransformbrowserArray.prototype.findLastpoint-freeredactconstObject.keyswidthtestglobal objectmomentArray.prototype.findLastIndexcolumnsavaObject.entriesECMAScript 2022omitschemedeterministicendershrinkwrappackage managerclass-validatorECMAScript 7animationwarningsettingsjavascripttoSortedjson-schema-validatorlengthdeepcopydataviewreversejsdiffgraphqlstringremoveminimaljsonUint8Arraythreeasteriskssinatratypeerrorprotocol-buffersjsdomexecfileflagspopmotionObservablesascii256sliceUint32Arrayruntimehasschemacloudformationbeanstalkcss-in-jsPromiseconcatnativerapidatomutilitycryptocodesTypedArrayharmonyES6YAMLmkdirreworkECMAScriptcloudsearchidentifiersassertstypeshellfunction.lengthmobileignorevisualArray.prototype.flattensyntaxmakenegative zerocoerciblefigletCSSfast-deep-copyupsymbolreact-hook-formpropertiesnopeaccessibilitygroupfullwidthcoreramdadeep-clonepushglobalsbrowserlistrouterwgetargumenteventsinstallautoprefixermapeventDispatcherkoreanintrinsicInt8Arrayrmdircore-jsRegExp#flagsdeepclonemergereversedrequestgetintrinsiccontainsECMAScript 2015inspectimmutablequeueMicrotaskes7emitbinfast-clonemetadatavarss3numbertypedEStimetypedarraystructuredClonedataes-shim APIWeakMapdom-testing-libraryES5patchvalidationidinternalstringifyparentslintdeleteoptionuser-streamsfantasy-landgetOwnPropertyDescriptormrurm -fres2018arraystc39copyqsvalidategdproncedescriptionpackage.jsonchromiumreusecharacterselfajaxtoolkitworkerkeyses2016entriespicomatchzodwalkasynccssbufferurlstyleguideastconsumebundlingscheme-validationstyleprunetraversedescriptorlocationES2021pretty_.extendglobal this valuereducerlogES3namesHyBieventEmitterrestfulspechookformtypanionjestpolyfillwriteelasticacheMapbinaryfsjson-schema-validationobjectfunctionWebSocketsprivatezxinstallerunicodewalkinggetterTypeScriptlasteslint-pluginequalityiamdeepreactpositiveoffsetec2busyURLSearchParamsairbnbxtermuuidexecuteRegExp.prototype.flagstacitform-validationArray.prototype.includesclassesmulti-packagestringifierchaiperformantoutputspinnerawsglacierBigInt64ArrayquoteSystem.globalbyteLengthSymbolESnextajvtrimStartfast-deep-cloneReactiveExtensionsStreamsgetoptjsslotcalles2015callboundsharedsameValueZerobabelyupmanipulationclassnames3debskeyownsource mapfindLastIndexTypeBoxJSONfiletextECMAScript 2021$.extendrecursivebyteOffsethas-owncachestarterPushjasminecode points.gitignoremonorepoFunction.prototype.nameecmascriptsymlinksgenericstranspileframerbannerpropertyfixed-widthexpressionresolveStreamdataViewtesterObject.assigntslibchromechinesemodulesponyfilltranspilerforEachcoloursetImmediatebabel-coretoobjectdayjs-0awesomesauceAsyncIteratorECMAScript 2019accessorarraybufferenvstreamregular-expressionObject.definePropertybyteinternal slotRxserializerenumerablecoveragecharactersArrayBuffer#slicepackagescompilerclassnameECMAScript 6gesturesArrayhelpersObject.fromEntriesjsxES2019objString.prototype.trimdotenvFloat64ArraynodedefinePropertyclifast-copymovetransportpromiselistenersendpointinferencequerystring.envdescriptorsWebSocketformsloggingObject.valuessetPrototypeOfimmersimpledbclientprototypestableprefixspeedprotowindowReactiveXtypescriptextenddateefficientrobustjoiimportspinnersutil.inspectdependency managernodejsttyelectronxhreveryamazonArrayBufferarraysnscall-boundrequirei18ncheckreduxmanagerdebuggerpropfastcopyio-tsmapreduceserializeprotobufFloat32ArrayfindLastcomparenamepackagecloudwatchenvironmentsreadable[[Prototype]]ES2020curriedtoReversedObjectMicrosofthardlinkswhatwgdependenciesdirguiderrorsortexpressquerytrimcensorapifpsreact animationnpmignoreassigndefineelbvalidshebangrds__proto__mocharsscollection.es6linkstyleswaitfunctionalargsECMAScript 2017Array.prototype.flattestingwebprocessutileffect-tsgetPrototypeOfeslintpluginworkflowcommand-lineextratapees-abstractES2018real-timecollectionglobalbindflattenpnpm9consoleBigUint64ArrayreduceSymbol.toStringTagsuperagentweakmapweaksetdropeast-asian-widthtypeoflogger
6.6.113

10 months ago

6.5.113

10 months ago

6.5.111

10 months ago

6.5.112

10 months ago

6.5.110

10 months ago

6.5.109

10 months ago

5.5.109

10 months ago

5.5.108

10 months ago

5.5.107

10 months ago

5.5.106

10 months ago

5.5.105

10 months ago

5.5.104

10 months ago

5.5.103

10 months ago

5.5.102

10 months ago

5.5.101

10 months ago

5.5.100

10 months ago

5.5.99

10 months ago

5.5.98

11 months ago

5.5.97

11 months ago

5.5.96

11 months ago

5.5.95

11 months ago

5.5.94

11 months ago

5.5.93

11 months ago

5.5.92

11 months ago

5.5.91

11 months ago

5.5.90

11 months ago

5.5.89

11 months ago

5.4.89

11 months ago

5.4.88

11 months ago

5.4.87

11 months ago

5.4.86

11 months ago

5.4.85

11 months ago

5.4.84

11 months ago

5.4.83

11 months ago

5.4.82

11 months ago

5.4.81

11 months ago

5.4.80

11 months ago

5.4.79

11 months ago

5.4.78

11 months ago

5.4.77

11 months ago

5.4.76

11 months ago

5.4.75

11 months ago

5.4.74

11 months ago

5.4.73

11 months ago

5.4.72

11 months ago

5.4.71

11 months ago

5.4.70

11 months ago

5.4.69

12 months ago

5.4.68

12 months ago

5.4.67

12 months ago

5.4.66

12 months ago

5.4.65

12 months ago

5.4.64

12 months ago

5.4.63

12 months ago

5.4.62

12 months ago

5.4.61

12 months ago

5.4.60

12 months ago

5.4.59

12 months ago

4.4.59

12 months ago

4.4.58

12 months ago

4.4.57

12 months ago

4.4.56

12 months ago

4.4.55

12 months ago

4.3.55

12 months ago

4.3.54

12 months ago

4.3.53

12 months ago

4.3.52

12 months ago

4.3.51

1 year ago

4.3.50

1 year ago

4.3.49

1 year ago

4.3.48

1 year ago

4.3.47

1 year ago

4.3.46

1 year ago

4.3.45

1 year ago

4.3.44

1 year ago

4.3.43

1 year ago

4.3.42

1 year ago

4.3.41

1 year ago

4.3.40

1 year ago

4.2.40

1 year ago

4.2.39

1 year ago

4.2.38

1 year ago

4.2.37

1 year ago

4.1.37

1 year ago

4.1.36

1 year ago

4.1.35

1 year ago

4.1.34

1 year ago

4.1.33

1 year ago

4.1.32

1 year ago

4.1.31

1 year ago

4.1.30

1 year ago

4.1.29

1 year ago

4.1.28

1 year ago

4.1.27

1 year ago

4.1.26

1 year ago

4.1.25

1 year ago

3.1.25

1 year ago

3.1.24

1 year ago

3.1.23

1 year ago

3.1.22

1 year ago

3.1.21

1 year ago

3.1.20

1 year ago

3.1.19

1 year ago

3.1.18

1 year ago

3.0.18

1 year ago

3.0.17

1 year ago

3.0.16

1 year ago

3.0.15

1 year ago

2.0.15

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago