1.0.16 • Published 1 year ago

@clerksystems/secretary v1.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
1 year ago

Secretary Log Module

Table of Content

Description

The exported function is a factory for factories, this way you can provide a config that is used by all the individual loggers.

Main factory options

OptionDescription
options.dbSequelize options
options.db.storageWhere to save the database
options.db.loggingShould Sequelize log its actions?
options.log
options.log.verboseShould secretary log its internal actions?
options.log.maxNrOfItemsHow many items may be stored in the database
options.log.itemThresholdHow many items the database should be able to store safely without overflowing
options.log.maxCacheHow many items the cache can hold
options.log.uploadBulkSizeHow many logs are in a single batch for uploading
options.log.onOnlineThis function takes a function which gets triggered when online status changes
options.log.uploadThis function is used to upload data

Factory options

OptionDescription
options.sourceLogger source name
options.instructionsObject describing minimum levels and their log output
options.stylesOverwrite default styling, use an object with level as key and chalk color function as value
options.standardTraceStartup logging function if its enabled in main options.log.verbose
options.debugBoolean indicating if debug messages should be traced
options.dbLoggerCustom database logger

Default log levels

OptionDescription
emergencySystem unusable - exiting / shutting down
alertAct now or the application shuts down
criticalError on app level, but trying to continue
errorError on operation level. Definitely a problem that should be investigated. SysAdmin should be notified automatically, but doesn't need to be dragged out of bed. By filtering a log to look at errors and above you get an overview of error frequency and can quickly identify the initiating failure that might have resulted in a cascade of additional errors. Tracking error rates as versus application usage can yield useful quality metrics such as MTBF which can be used to assess overall quality
warningThis MIGHT be problem, or might not. For example, expected transient environmental conditions such as short loss of network or database connectivity should be logged as Warnings, not Errors. Viewing a log filtered to show only warnings and errors may give quick insight into early hints at the root cause of a subsequent error.
noticeNormal but significant
infoNormal messages shouldn't be to many
debugEverything else, also this level is turned off from the console in production

Thoughts for future development

LogType

id source dataType type

0 product string filters-loading 1 product string startup-state 2 framework bool cloud-online-state 3 framework bool product-is-active

4 roon string sync-state

LogItem

id logTypeId level value

0 0 error could not load store 1 0 debug starting 2 1 info true 3 2 notice false

4 4 error { "msg": "lost", "time": 90654 } 4 4 error "found"

LogItem (large)

id source dataType type level data 0 product string filters-loading error could not load store

const logger = source -> type -> ( level, msg )

frmLogger( 'filter-state' )( 'mijn harde bericht' )

<5> sdfghjkl

const filterLogger = frmLogger.createType( 'filter-state' )

filterLogger.error( 'could not load' )

logger.syncTypes() ==> "delay"

logger.createType( 'delay', 'integer' )

1.0.16

1 year ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago