Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename log.priority to log.level #112

Merged
merged 1 commit into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 33 additions & 24 deletions docs/api-reference/log/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ log.log(2, () => `${expensiveFunction()}`)();
### Log Function Parameters

Log functions can be called with different parameter combinations
- `log.log(message, ...args)` - priority defaults to 0
- `log.log(priority, message, ...args)` - sets priority
- `log.log({message, ...options})` - additional options can be set, priority is zero
- `log.log({priority, message, args, ...options})` - additional options can be set
- `log.log(message, ...args)` - logLevel defaults to 0
- `log.log(logLevel, message, ...args)` - sets logLevel
- `log.log({message, ...options})` - additional options can be set, logLevel is zero
- `log.log({logLevel, message, args, ...options})` - additional options can be set


### Log Function Options
Expand All @@ -47,7 +47,7 @@ When using named parameters (passing an object as first parameter), the followin

| Option | Type | Description |
| --- | --- | --- |
| `priority` | `Number` | This probe will only "fire" if the log's current priority is greater than or equal to this value.defaults to `0`, which means that the probe is executed / printed regardless of log level. |
| `logLevel` | `Number` | This probe will only "fire" if the log's current logLevel is greater than or equal to this value.defaults to `0`, which means that the probe is executed / printed regardless of log level. |
| `time` | `Boolean` | Add a timer since page load (default for `Log.probe`) |
| `once` | `Boolean` | Logs this message only once (default for `Log.warn`, `Log.once` |
| `tag` | `String` | Optional tag |
Expand Down Expand Up @@ -78,19 +78,28 @@ Creates a new `Log` instance.

`new Log({id})`

### enable

### getPriority
`log.enable(false)`

`log.getPriority()`
Accepts one argument `true` or `false`.

### getLevel

`log.getLevel()`

### setLevel

`log.setLevel(newLevel)`


### log

Log a debug level message (uses `console.debug` if available)

`log.log(message, ...args)`
`log.log(priority, message, ...args)`
`log.log({priority, message, args, ....options})`
`log.log(logLevel, message, ...args)`
`log.log({logLevel, message, args, ....options})`

Returns: a function closure that should be called immediately.

Expand All @@ -100,8 +109,8 @@ Returns: a function closure that should be called immediately.
Log a normal message (uses `console.info` if available)

`log.info(message, ...args)`
`log.info(priority, message, ...args)`
`log.info({priority, message, args, ....options})`
`log.info(logLevel, message, ...args)`
`log.info({logLevel, message, args, ....options})`

Returns: a function closure that should be called immediately.

Expand All @@ -110,7 +119,7 @@ Returns: a function closure that should be called immediately.

Log a normal message, but only once, no console flooding

`once(priority|opts, arg, ...args)`
`once(logLevel|opts, arg, ...args)`

Returns: a function closure that should be called immediately.

Expand All @@ -120,8 +129,8 @@ Returns: a function closure that should be called immediately.
Log a message with time since page load

`log.probe(message, ...args)`
`log.probe(priority, message, ...args)`
`log.probe({priority, message, args, ....options})`
`log.probe(logLevel, message, ...args)`
`log.probe({logLevel, message, args, ....options})`

Returns: a function closure that should be called immediately.

Expand Down Expand Up @@ -167,7 +176,7 @@ Returns: a function closure that should be called immediately.

Logs a table (using `console.table` if available).

`log.table(priority|opts, table)`
`log.table(logLevel|opts, table)`

Returns: a function closure that should be called immediately.

Expand All @@ -176,7 +185,7 @@ Returns: a function closure that should be called immediately.

Logs an image (under Chrome)

`log.image({priority, image, message = '', scale = 1})`
`log.image({logLevel, image, message = '', scale = 1})`


### settings
Expand All @@ -189,37 +198,37 @@ Logs the current settings as a table

Returns the current value of setting

`log.get('priority')`
`log.get('logLevel')`

### set(setting, value)

Updates the value of setting

`log.set('priority', 3)`
`log.set('logLevel', 3)`

### time

`log.time(priority, label)`
`log.time(logLevel, label)`


### timeEnd

`log.timeEnd(priority, label)`
`log.timeEnd(logLevel, label)`


### group

`log.group(priority, label)`
`log.group(logLevel, label)`


### groupCollapsed

`log.group(priority, label)`
`log.group(logLevel, label)`


### groupEnd

`log.groupEnd(priority)`
`log.groupEnd(logLevel)`


## Experimental APIs
Expand All @@ -229,7 +238,7 @@ Updates the value of setting

Provides an exception safe way to run some code within a group

`log.withGroup(priority, label, func)`
`log.withGroup(logLevel, label, func)`


### trace
Expand Down
Loading