GitHub image
floggy
⌘K
Named Exports
7
/
Exports
Functions
1
demo
Docs
Import
Tests
3
References
2
function demo(log?: RootLogger): void
Namespaces
1
Renderer
render
Docs
Import
Tests
3
References
2
function render(opts: Options, logRecord: LogRecord): string
separators
Docs
Import
Tests
3
References
2
{
path: { symbol: string }
event: { symbol: string }
context: { singleLine: { symbol: string, color: any }, multiline: { symbol: string } }
contextKeyVal: {
singleLine: { symbol: string, color: any }
multiline: { symbol: string }
}
contextEntry: {
singleLine: string
multiline: (gutterSpace: string) => { symbol: string, color: any }
}
}
Options
Docs
Import
Tests
3
References
2
type Options = { levelLabel: boolean, timeDiff: boolean, color: boolean }
Type Aliases
5
Logger
Docs
Import
Tests
3
References
2
type Logger = {
fatal: Log
error: Log
warn: Log
info: Log
debug: Log
trace: Log
addToContext: (context: Context) => Logger
child: (name: string) => Logger
}
RootLogger
Docs
Import
Tests
3
References
2
type RootLogger = Logger & { settings: SettingsManager }
SettingsData
Docs
Import
Tests
3
References
2
type Readonly<T'> = Readonly
SettingsInput
Docs
Import
Tests
3
References
2
type Input = {
output?: Output

Filter logs by path and/or level.

By default the pattern is '*'. The "default level" defaults to the first value found in:

  1. LOG_LEVEL envar if set
  2. 'info' if NODE_ENV envar set to 'production'
  3. 'debug'

@examples

Logs from foo logger

foo

Logs from foo or bar logger

foo,bar

Logs from not foo logger

!foo

Logs from foo logger at level 3 (info) or higher

foo@3+

Logs from any logger at level 3 (info) or higher

foo@info+

Logs from foo logger at level 3 (info) or lower

foo@3-

Logs from foo:sub logger

foo:sub

Logs from any descendants of foo:sub logger

foo:sub:*

Logs from any descendants of foo:sub logger or foo:sub logger itself

foo:sub*

filter?:
|
string
|
{

Filter logs by path and/or level.

pattern?: string

todo revise jsdoc, the concept of this has changed Set the minimum level a log must be at for it to be written to output.

This level setting has highest precedence of all logger level configuration tiers.

level?: Name
}

Control pretty mode.

Shorthands:

  • true is shorthand for { enabled: true }
  • false is shorthand for { enabled: false }

When undefined pretty takes the first value found, in order:

  1. process.env.LOG_PRETTY (admits case insensitive: true | false)
  2. process.stdout.isTTY
pretty?:
|
false
|
true
|
{

Disable or enable pretty mode.

When undefined pretty takes the first value found, in order:

  1. process.env.LOG_PRETTY (admits case insensitive: true | false)
  2. process.stdout.isTTY
enabled?: boolean

Should logs be colored?

color?: boolean

Should logs include the level label?

levelLabel?: boolean

Should the logs include the time between it and previous log?

timeDiff?: boolean
}

Toggle pieces of data that should or should not be logged.

data?: {

The Unix timestamp in milliseconds when the log was written to the output.

time?: boolean

The current node process ID assigned by the operating system. Acquired via process.pid.

pid?: boolean

The host name of the machine this process is running on. Acquired via OS.hostname().

hostname?: boolean
}
}
log
Docs
Import
Tests
3
References
2
type RootLogger = Logger & { settings: SettingsManager }
Description
![trunk](https://github.com/graphql-nexus/logger/workflows/trunk/badge.svg)
Install
yarn add floggy
Copy
Details
MIT License
4 Dependencies
Native TypeScript Package
Links
Metrics
Weekly Downloads
Keywords