4.5.117 • Published 11 months ago

@devtea2026/quae-eaque-nesciunt-necessitatibus v4.5.117

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

Logtopus

Build Status

Logtopus is a powerful logger for Node.js with different transports

Logtopus Logger

Built in logger:

Additional logger:

Usage

const log = require('@devtea2026/quae-eaque-nesciunt-necessitatibus').getLogger('mylogger');
log.setLevel('sys');

log.warn('My beer is nearly finish!');

Log levels

debug    development  Logs debugging informations
info     development  Helpful during development
res      staging      Logs requests
req      staging      Logs responses
sys      production   Logs application states
warn     production   Logs warnings
error    production   Logs errors

For example, setting log level to req includes these log levels: req, sys, warn, error Setting log level to debug means all log levels are activated log level error logs errors only.

Example:

log.setLevel('res');        // To be ignored in this log level
log.debug('Log example:');  // To be ignored in this log level
log.info('This would not be logged');
log.res('POST /account');
log.req('200 OK');
log.sys('Request done!');
log.warn('Request was unauthorized!');
log.error('An error has been occurred!');

// prints

res: POST /account
req: 200 OK
sys: Request done!
warn: Request was unauthorized!
error: An error has been occurred!

Express logger

Logtopus comes with a logger for Express/Connect.

@devtea2026/quae-eaque-nesciunt-necessitatibus.express() returns a middleware for Express/Connect. It acepts an optional options object

let express = require('express');
let @devtea2026/quae-eaque-nesciunt-necessitatibus = require('../@devtea2026/quae-eaque-nesciunt-necessitatibus');

let app = express();

app.use(@devtea2026/quae-eaque-nesciunt-necessitatibus.express({
  logLevel: 'debug'
}));

Options

logLevel Sets current log level

Koa logger

Logtopus also supports Koa

@devtea2026/quae-eaque-nesciunt-necessitatibus.koa() returns a middleware for Koa. It acepts an optional options object

let koa = require('koa');
let @devtea2026/quae-eaque-nesciunt-necessitatibus = require('../@devtea2026/quae-eaque-nesciunt-necessitatibus');

let app = koa();

app.use(@devtea2026/quae-eaque-nesciunt-necessitatibus.koa({
  logLevel: 'debug'
}));

Options

logLevel Sets current log level

Adding custom loggers

Logtopus was designed as an extensible logger. You can add a custom logger by creating a logger class and load it into @devtea2026/quae-eaque-nesciunt-necessitatibus. The example below shows a minimal logger class.

class LogtopusLogger {
  constructor(conf) {
    // conf contains the logger conf
  }

  log(logmsg) {
    const date = logmsg.time.toISOString()
    console.log(`[${date}] ${logmsg.msg}`)
  }
}

module.exports = LogtopusLogger

The logger class requires a log method. It takes one argument which contains a log object. The first argument of a log call is the log message, all other arguments are log data.

logmsg: {
  type: 'info', // The logtype eg: debug, info, error, sys
  msg: 'Log message string', // Log message, but without CLI color codes
  cmsg: 'Colorized log message', // Log message with CLI color codes
  time: new Date(), // Current date
  uptime: process.uptime(), // Process uptime in ms
  data: [] // All other arguments as an array
}

Now, the class has to be load into @devtea2026/quae-eaque-nesciunt-necessitatibus. You can do it by using the .addLogger() method if your logger is a priveate logger. Otherwis publish it on npm by using our logger name conventions. @devtea2026/quae-eaque-nesciunt-necessitatibus-${loggername}-logger Add a new config block into the @devtea2026/quae-eaque-nesciunt-necessitatibus config by using loggername as namespace and @devtea2026/quae-eaque-nesciunt-necessitatibus tries to load the logger.

const log = @devtea2026/quae-eaque-nesciunt-necessitatibus.getLogger('mylogger')
log.addLogger('loggerName', loggerClass)
httpcolourparentWebSocketscss nestingkoreangetPrototypeOfidleRxJSutilityes2016sharedarraybuffercopyprotointernal slotcharacterdeleteserializeforEachcachelesscsschromiumRegExp.prototype.flagsconcurrencyavaJSONfunctionalconnectperformance__proto__commandertypescriptmacosfseventsfilternodehardlinkscorecloudfrontvalidproxyinferenceworkflowcloudsearchreact-hooksoutputbundler.envclassnamesES7moverobustamazonreadrapidzodRxrequestspinnerwidthMicrosoftArray.prototype.includesjoireuseeslintpluginArrayBuffer.prototype.slicefunctionsECMAScript 2015curlautoprefixerlockfilecode pointssettingsArray.prototype.findLastwarningshimmatchAllwriteentriesworkertestingmakeECMAScript 2017packagehasOwndeep-cloneequalitynested cssstructuredCloneregexpglobalurlsendersameValueZeromomentsigintsnsbufferhandlersrestfulenvcommandconfigurablestringless.jsparsingpersistentjasminevisualcolorses2015concatshrinkwrapRegExp#flagswhatwgstreamstoolslruObservablespicomatchsidecircularhashratematchprotocol-buffersfastifyincludesschemeplugintermebsjsonjestJSON-SchemaArray.prototype.containsReflect.getPrototypeOfArray.prototype.filtertouchinfromfull-widthbrowserObjectstartervarsapphigher-orderflagroutermodulesymlinksassignsuperstructponyfilllastarraywafinvarianthookformconsumepreserve-symlinkstimespinnerslibphonenumbermake dircloudformationformatreadablereplaylinkmonorepostyleguideRFC-6455flatdropmulti-packageexpressionqueuemapsyntaxdirajaxbeanstalktypeslookspecrgbCSSStyleDeclarationString.prototype.trimSymbol.toStringTagcloudtrailnegative zerodefaultECMAScript 7mime_.extendBigUint64Arraylogvalidationexec@@toStringTagclassnamegetOwnPropertyDescriptorbuffersschemajsdifftapclonetoSortedcontainsloggingboundCSSwalkingcallES2016npmdeterministictestlessclassesresolvechildxdgterminalYAMLregexview[[Prototype]]unicodeminimalmkdirputil.inspectxhrindicatorURLSearchParamseslintconfigrequirecheckquotecryptotoolkitexitlaunchyuptypedasserteditorinspectextendutilitiesenvironmentsbytetypedarraysweakmaptoStringTagloadbalancingECMAScript 3core-jswindowswatcherargumentFunction.prototype.namepathdependencieskeysortdatastructurecompareargssetterpruneeventDispatcherwatchhasOwnPropertyUnderscoreloggeriamesstatelesshookswaitjsxES2019autoscalingvariables in cssObject.keysES2015es5ArrayBuffersymbolpatchchineseimportexportObject.getPrototypeOfscheme-validationslotless mixinsmapreducevalidateStreamsbootstrap cssECMAScript 2020wordbreakqueueMicrotaskreducegradients csssortedstdlibhelperseast-asian-widthrfc4122dataViewdefinePropertyphonetc39a11ysearchiterateprogresspolyfillasyncESnexti18nfastcopyFloat32Arrayreact-hook-formUint8ClampedArraytslibfindupTypeBoxparserstringifycoercibleArray.prototype.flattencryptregulargroupfaststyleses-shim APIregular expressionswritabledescriptores8channeliees2017environmenttoArraythrottlerecursiveelmReactiveExtensionspostcss-pluginartrm -frshamfullisConcatSpreadablereduxexit-codees-abstractinternalefficientapidynamodbstringifiersharedsequencemixinsString.prototype.matchAlles-shimslimitedECMAScript 2021interruptsaccessibilityfast-clonemodulespyyamlserializationformsjshintreactfolderexecutablecallboundtrimRightbindvariablesfast-deep-copyhas-ownbyteLengthes2018trimEndStreamObject.assigntypeofnativeenumerabletsstylesheetreducerInt16ArraytypanionresteveryruntimekinesistelephonemruajvObject.fromEntriesiteratorshellcall-boundUint16ArrayBigInt64Arrayargumentsfigletpredictablebundlingset-0extraidentifiersECMAScript 2019querystringnegativetypeerroransiawsES2018webES8flattenwebsitegetterassertsfetchswfbusyes6immutableweakset$.extendbootstrap lesskarmafastcloneagentsymbolssyntaxerrorairbnbECMAScript 2022package managersqswalkES2022name256sliceratelimitparentsescapematchespackagesemitjapanesestreams2WebSocketjsownfullwidthArraychromeoptimistcollection.es6Symboldayjsloadingcompile lessperformantstyled-componentscreatevpceventsroute53superagentIteratorglacierflatMapbyteOffsetTypeScriptopenECMAScript 2016randomexpresssomeArray.prototype.flatMapexepromisegetintrinsicObject.definePropertylintfindLastargparseconfigHyBiremovedeep-copyAsyncIteratorTypedArrayglobalsfindutilsinatrachaiArray.prototype.findLastIndexsignalscallbackreact-testing-libraryecmascriptobjectwrapoptionstylingnopefileclass-validatorpipejsonpathxdg-opencharacterstakecss-in-jslistenersArrayBuffer#slicepropertycolumnscolumnduplexprivate datasetImmediatebddelasticachesesarktypeastelbtrimStartjsdomformattinginstallereslintwatchFiledom-testing-librarysymlinkprototyperedactflagscss lesswhichglobPromisecssqs
4.5.117

11 months ago

4.5.116

11 months ago

4.5.115

11 months ago

4.5.114

11 months ago

4.5.113

11 months ago

4.5.112

11 months ago

4.5.111

11 months ago

4.5.110

11 months ago

1.1.29

1 year ago

1.1.28

1 year ago

1.1.30

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.32

1 year ago

1.1.31

1 year ago

1.1.38

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.35

1 year ago

3.4.58

1 year ago

3.4.59

1 year ago

1.1.39

1 year ago

3.4.50

1 year ago

3.4.51

1 year ago

3.4.52

1 year ago

3.4.53

1 year ago

3.4.54

1 year ago

3.4.55

1 year ago

3.4.56

1 year ago

3.4.57

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

4.5.106

11 months ago

4.5.107

11 months ago

4.5.108

11 months ago

4.5.109

11 months ago

1.1.42

1 year ago

4.5.102

11 months ago

4.5.103

11 months ago

4.5.104

11 months ago

4.5.105

11 months ago

4.5.90

11 months ago

4.5.91

11 months ago

3.3.50

1 year ago

4.5.94

11 months ago

4.5.95

11 months ago

4.5.92

11 months ago

4.5.93

11 months ago

4.5.98

11 months ago

4.5.99

11 months ago

4.5.96

11 months ago

4.5.97

11 months ago

3.5.88

12 months ago

3.5.87

12 months ago

3.5.86

12 months ago

3.5.85

12 months ago

3.5.84

12 months ago

4.5.88

12 months ago

4.5.89

11 months ago

3.5.83

12 months ago

1.1.23

1 year ago

3.5.82

12 months ago

1.1.22

1 year ago

3.5.81

12 months ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

3.4.80

12 months ago

3.4.81

12 months ago

2.1.43

1 year ago

2.1.42

1 year ago

3.4.69

1 year ago

3.2.46

1 year ago

3.2.45

1 year ago

4.5.100

11 months ago

3.2.48

1 year ago

4.5.101

11 months ago

3.2.47

1 year ago

3.2.49

1 year ago

3.4.61

1 year ago

3.4.62

1 year ago

3.4.63

1 year ago

3.4.64

1 year ago

3.4.65

1 year ago

3.4.66

1 year ago

3.4.67

1 year ago

3.2.44

1 year ago

3.4.68

1 year ago

3.4.60

1 year ago

3.4.72

12 months ago

3.4.73

12 months ago

3.4.74

12 months ago

3.4.75

12 months ago

3.2.50

1 year ago

3.4.76

12 months ago

3.4.77

12 months ago

3.4.78

12 months ago

3.4.79

12 months ago

3.4.70

1 year ago

2.2.44

1 year ago

3.4.71

12 months ago

2.2.43

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