# @clerksystems/secretary

> Logger

Latest version **2.0.2** (published 2026-05-15) · ISC license · 267 weekly downloads

## Install

```sh
npm install @clerksystems/secretary
pnpm add @clerksystems/secretary
yarn add @clerksystems/secretary
bun add @clerksystems/secretary
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2026-05-15 |
| First published | 2019-05-02 |
| Weekly downloads | 267 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 157 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kevin Kleine, Clerk Systems |
| Maintainers | kevinkleine, jwverzijden, clerk-systems |

## Links

- npm: https://www.npmjs.com/package/@clerksystems/secretary
- Homepage: https://github.com/dutchanddutch/secretary#readme
- npm.io page: https://npm.io/package/@clerksystems/secretary

## Dependencies (4)

- [colors](https://npm.io/package/colors.md) ^1.1.2
- [stack-trace](https://npm.io/package/stack-trace.md) 0.0.9
- [stacktrace-js](https://npm.io/package/stacktrace-js.md) ^1.3.1
- [@clerksystems/utilities](https://npm.io/package/@clerksystems/utilities.md) 2.0.0

## Recent versions

- 2.0.2 (latest) — 2026-05-15
- 2.0.1 — 2026-02-06
- 2.0.0 — 2026-02-06
- 1.0.16 — 2023-02-17
- 1.0.15 — 2022-03-29
- 1.0.14 — 2022-03-29
- 1.0.13 — 2022-03-29
- 1.0.12 — 2022-01-05
- 1.0.11 — 2021-12-28
- 1.0.10 — 2021-12-28
- 1.0.9 — 2021-08-13
- 1.0.8 — 2021-08-13
- 1.0.7 — 2021-02-25
- 1.0.6 — 2021-02-24
- 1.0.5 — 2019-08-12
- … 3 more at https://npm.io/package/@clerksystems/secretary/versions

## README

# Secretary Log Module

## Table of Content

 - [Description](#markdown-header-description)
     - [Main factory options](#markdown-header-main-factory-options)
     - [Factory options](#markdown-header-factory-options)
 - [Default log levels](#markdown-header-default-log-levels)


## 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
Option                          | Description
---                             | ---
options.db                      | Sequelize options
options.db.storage              | Where to save the database
options.db.logging              | Should Sequelize log its actions?
options.log                     |
options.log.verbose             | Should secretary log its internal actions?
options.log.maxNrOfItems        | How many items may be stored in the database
options.log.itemThreshold       | How many items the database should be able to store safely without overflowing
options.log.maxCache            | How many items the cache can hold
options.log.uploadBulkSize      | How many logs are in a single batch for uploading
options.log.onOnline            | This function takes a function which gets triggered when online status changes
options.log.upload              | This function is used to upload data


### Factory options
Option                          | Description
---                             | ---
options.source                  | Logger source name
options.instructions            | Object describing minimum levels and their log output
options.styles                  | Overwrite default styling, use an object with level as key and chalk color function as value
options.standardTrace           | Startup logging function if its enabled in main options.log.verbose
options.debug                   | Boolean indicating if debug messages should be traced
options.dbLogger                | Custom database logger


## Default log levels
Option              | Description
---                 | ---
emergency           | System unusable - exiting / shutting down
alert               | Act now or the application shuts down
critical            | Error on app level, but trying to continue
error               | Error 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
warning             | This 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.
notice              | Normal but significant
info                | Normal messages shouldn't be to many
debug               | Everything 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' )

---
_Source: https://npm.io/package/@clerksystems/secretary · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
