2.4.36 • Published 1 year ago

@kollorg/ipsum-eaque-quibusdam v2.4.36

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

fran-logging

Fran logger is a simple logging with an easy configuration. Supports level based filtering and tagging that keeps your logs readable and uncluttered!

Simple Features

  • Small footprint, around 500 bytes
  • Filter by level, ERROR > WARN > INFO > TRACE > DEBUG
  • Filter by tag, 'security' | 'anything'

Install

npm install fran-logging

Initialize

Tags typically refer to a subsystem or component like 'security' or FooBar.name. When fran-logging is initialized, tags can be assigned a level. A message is logged when its level is greater than or equal to its tag's assigned level.

import { log, LogLevel } from 'fran-logging';
import chalk from 'chalk';

// handler which does the logging to the console or anything
const logger = {
  [LogLevel.ERROR]: (tag, msg, params) => console.error(`[${chalk.red(tag)}]`, msg, ...params),
  [LogLevel.WARN]: (tag, msg, params) => console.warn(`[${chalk.yellow(tag)}]`, msg, ...params),
  [LogLevel.INFO]: (tag, msg, params) => console.log(`[${chalk.brightGreen(tag)}]`, msg, ...params),
  [LogLevel.TRACE]: (tag, msg, params) => console.log(`[${chalk.cyan(tag)}]`, msg, ...params),
  [LogLevel.DEBUG]: (tag, msg, params) => console.log(`[${chalk.magenta(tag)}]`, msg, ...params),
} as Record<LogLevel, (tag: string, msg: unknown, params: unknown[]) => void>;

/**
 * initialize fran-logging
 * @param config JSON which assigns tags levels. An uninitialized,
 *    tag's level defaults to DEBUG.
 * @param callback? handle logging whichever way works best for you
 */
log.init({ transporter: 'INFO', security: 'ERROR', system: 'OFF' }, (level, tag, msg, params) => {
  logger[level as keyof typeof logger](tag, msg, params);
});

Usage

import { log, tag } from 'fran-logging';

// the imported value "tag" is populated with YOUR tags!
log.error(tag.security, 'not authorized', statusCode);

// but if you prefer simply use strings
log.warn('transporter', 'Evil twin detected!');

// filtered since security's log level ERROR is greater than INFO
log.info(tag.security, 'login successful');

// trace
log.trace(tag.system, 'entering engine room');

// debug
log.debug(tag.system, { warpFactor, starDate });

// also filtered since system's level is OFF
log.error(tag.system, 'eject the warp core', error);

// updates tag levels on the fly
log.init({ loader: 'ERROR', system: 'INFO' });

// disable logging by clearing the callback
log.init();

Advanced Usage

Create an instance with its own tags and callback.

import { Log, tag } from 'fran-logging';

const myLog = new Log().init(
  { loader: 'INFO', security: 'ERROR' },
  (level, tag, msg, params) => {
    console.log(`${level}: [${tag}] `, msg, ...params);
});

myLog.info(tag.security, 'login successful');
inferencefixed-widthshelldirectoryFloat64Arraycss variablehttpsmovefigletsettingssomeflatrm -rfcssawesomesaucetypescriptcallboundmimetypesownhandlersrecursiveString.prototype.trimprogressAsyncIteratorlazyelbparsesimpledbimmutableregexrouterqswrapTypeBoxspinnersfast-copyfsHyBilessexit-codeES2023readlistenersnodejswaitPromisesymbolsdeterministicl10neventDispatcherdefinefolderperformantMaphigher-orderbootstrap cssgradients cssECMAScript 2019shebangrgbtrimLefttoArraystyled-componentsrm -frdirspinnerconsoleloggersigtermfilterfastifyendpointnamezodchromiumpropertiesSymbolStyleSheetwordbreakcode pointsstatelesssyntaxrmcloudtrailseslibphonenumberform-validationless.jscjkemrexpressionInt32ArrayglobstructuredClonetouchstarterdeep-clonetostringtagfindupURLSearchParamsthrottleaccessorttyInt16Arrayprocessbrowserdeep-copy@@toStringTagutil.inspectfastcopyBigUint64Arrayfastestreeajaxstringifierlastindicatorjsdomutilitiesponyfill[[Prototype]]ReactiveXreadablesyntaxerrorbundlermakeenvyamloperating-systemmapuninstallmake dirtoSortedwritableassignparserES2020workerfseventsclass-validatorreducerjwtpathECMAScript 2022awsonceeast-asian-widthproxyes-shimseventEmitterdotenvES2019formattingReflect.getPrototypeOfgetoptio-tsresterror-handlingeveryreal-timeIteratorJSONsortedtelephonemkdirpStreamboundroutevalidatelook-uproutingremoverapidECMAScript 3testerinspectprivateArray.prototype.includesrangeerrorES2021loadingsnstrimimportsettertraversewarningmkdirstreams2trimStartiteratewidthfunctionaleslintimportexportlengthvisualcoercibleauthenticationstreamformssharedglacierUint32Arraydeepwalkingwhich$.extendendercryptagentstatuskinesiscolumnnegativeprettyreplayfunctionES2018channelfluxArray.prototype.filtercss nestingzerorestfulextendlimitutilclonepyyamlsinatraconcurrencyES3inimmerastworkflowObservablescryptoenumerablees2016setImmediatecss lessgetOwnPropertyDescriptorECMAScript 2021httpgroupesArrayBufferamazonhas-ownurlclassnamefast-deep-cloneinstallclassescore-jsjasmineencryptiondebuggerstyleworkspace:*artaccessibilitybuffercommand-linedom-testing-librarybundlingtoolsfindLastIndexmobilecollection.es6internal slotnpminputmatchobjectmetadataURLECMAScript 7iampackagescallmixinswatchFilepackage managerhardlinksintrinsicCSSkarmaiscolourebsefficientargparsekeysjsonpathtimebyteschemeUint16ArrayruntimelinewraplinkcreateFloat32ArrayJSON-Schemas3autoprefixerenvironmentdynamodbecmascriptPushidleequalityfullkeyflatMapless compilerargumentvaluereusecheckhooksthroatieratelimitpatchUint8ClampedArrayrateECMAScript 6sameValueZeroquotequerystringqueryregular expressionsauthmrufrombusynegative zerotyped arrayprotocol-buffersroute53escapecontainscachetoobjectcodesproptc39censorwatchString.prototype.matchAllmatchestrimRightbddansidebugcall-boundObject.getPrototypeOfprotodescriptorBigInt64ArrayWebSocketrequestshamFunction.prototype.name_.extendsymlinkyupgetterreact-hooksTypeScriptconsumebufferses6byteLengthcss-in-jsoptionstringifyargvperformanceregular expressionstateconfigurablespeedweakmapterminalreact-testing-libraryhasOwnECMAScript 2015Object.ismacossidedatastructurearktypetapeconcatMapgroupBycurlelasticachextermlimitedbcryptpostcssvariablesdatefull-widthObject.entriespackageObjectArrayBuffer#slicetypesafe0columnses2015RegExp#flagsfind-uprfc4122ES2015searchcloudwatchmapreducelockfileargssignalstypedarrayses-abstractregexpiterationcloudformationiteratores-shim APIpnpm9functionslinuxreact-hook-formcomparerdsmergesafetypeYAMLisConcatSpreadablelookpasswordtrimEndwatcherforEachstdlibjQuerystylingredux-toolkitappdependencieswafcommanderES2017chromeless csshelpersObject.keysjoisigintReactiveExtensionsvalidationtestingsetPrototypeOfstoragegatewayec2postcss-plugincollectionstablejsoneventsframeworkextrainvariantformatsymbolswffast-deep-copylruECMAScript 2020CSSStyleDeclarationplugincallbackes5propertyoffsetless mixinspreprocessordataViewdatavalidcompilerprototypedescriptionapiflattenmime-dbmatchAlldataviewECMAScript 2017stringRFC-6455eslintconfigECMAScript 2018watchingvpcsharedarraybufferomitcolorstyleguidepromisexhrjavascriptESnextArray.prototype.findLastIndextsgdprunicodetaskminimalupredactqueuepromiseseslint-pluginsignalhasprivate datanopeserializees2017reduceObject.fromEntriesgetPrototypeOfArrayBuffer.prototype.sliceairbnbfastcloneStreamsdiffparentsflagspectextbluebirdWebSocketsgenericspicomatchinstallerfpselectronObject.assignObject.valuesArray.prototype.findLastprunetapnodeES2016package.jsondropemitES6types
@kollorg/eveniet-praesentium@kollorg/eveniet-et@kollorg/exercitationem-assumenda-qui@kollorg/fuga-harum@kollorg/facere-optio@kollorg/fugiat-animi@kollorg/facilis-eum@kollorg/fugiat-cum-libero@kollorg/fuga-ipsum-illum@kollorg/facere-suscipit@kollorg/fugit-id-quisquam@kollorg/fuga-laborum@kollorg/ipsam-omnis@kollorg/ipsum-porro@kollorg/ipsum-sint@kollorg/itaque-voluptatum@kollorg/ipsam-labore@kollorg/labore-facilis-ab@kollorg/iste-sed-quos@kollorg/itaque-laudantium-nesciunt@kollorg/labore-facilis@kollorg/laudantium-molestias@kollorg/labore-minus-nesciunt@kollorg/laboriosam-neque@kollorg/labore-quidem@kollorg/laudantium-fuga@kollorg/labore-magnam@kollorg/magnam-iure@kollorg/magnam-natus@kollorg/libero-iste-molestiae@kollorg/molestias-asperiores@kollorg/minus-eveniet-dolor@kollorg/modi-fugit-accusantium@kollorg/molestias-non@kollorg/molestias-aperiam@kollorg/molestias-quae-iste@kollorg/modi-saepe@kollorg/molestiae-pariatur@kollorg/mollitia-cupiditate@kollorg/natus-ipsum@kollorg/mollitia-neque-maiores@kollorg/natus-tenetur-laudantium@kollorg/nemo-omnis@kollorg/necessitatibus-qui@kollorg/neque-non@kollorg/nihil-dolorem@kollorg/nisi-deserunt-suscipit@kollorg/nisi-aliquid-eum@kollorg/officia-voluptatem-eius@kollorg/officiis-earum-ducimus@kollorg/odio-cupiditate@kollorg/officia-porro@kollorg/occaecati-totam@kollorg/odit-exercitationem@kollorg/officia-explicabo@kollorg/odio-aspernatur@kollorg/odit-accusantium@kollorg/praesentium-perferendis@kollorg/quae-nam-minus@kollorg/provident-unde@kollorg/placeat-sapiente@kollorg/possimus-dolorem-occaecati@kollorg/possimus-dolores@kollorg/provident-ab-facilis@kollorg/qui-itaque@kollorg/quaerat-veritatis@kollorg/quam-hic@kollorg/quaerat-dolorem-soluta@kollorg/quaerat-error@kollorg/quaerat-ad@kollorg/quidem-dolores-ad@kollorg/quis-dolorem@kollorg/quisquam-totam@kollorg/repudiandae-accusamus-corrupti@kollorg/rerum-quaerat-et@kollorg/saepe-eum@kollorg/rerum-laudantium@kollorg/sapiente-consequatur-maxime@kollorg/rem-rem@kollorg/saepe-rem@kollorg/saepe-ut@kollorg/reiciendis-pariatur@kollorg/reiciendis-rem@kollorg/unde-quae-dignissimos@kollorg/unde-ullam@kollorg/temporibus-quas@kollorg/tenetur-eius@kollorg/ullam-consequuntur@kollorg/ullam-modi@kollorg/tempora-maiores@kollorg/unde-commodi-illo@kollorg/temporibus-explicabo@kollorg/veritatis-eius@kollorg/vitae-tempore-qui@kollorg/veritatis-aliquam@kollorg/veritatis-alias@kollorg/vitae-quia-incidunt@kollorg/vero-quaerat-itaque@kollorg/voluptatum-veniam@kollorg/animi-quisquam
2.1.19

1 year ago

2.3.28

1 year ago

2.3.27

1 year ago

2.3.29

1 year ago

2.4.36

1 year ago

2.3.24

1 year ago

2.4.35

1 year ago

2.3.23

1 year ago

2.3.26

1 year ago

2.1.21

1 year ago

2.3.25

1 year ago

2.4.32

1 year ago

2.4.31

1 year ago

2.1.20

1 year ago

2.4.34

1 year ago

2.4.33

1 year ago

2.4.30

1 year ago

2.0.19

1 year ago

2.4.29

1 year ago

2.2.22

1 year ago

2.2.23

1 year ago

2.2.21

1 year ago

2.0.18

1 year ago

2.0.17

1 year ago

2.0.15

1 year ago

2.0.16

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

1.0.8

1 year ago

1.0.7

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