mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-08 08:43:53 +01:00
DOCUMENTATION: Clarify logging API (#1444)
This commit is contained in:
parent
f620ec889c
commit
21e984bda6
@ -4,7 +4,7 @@
|
||||
|
||||
## NS.disableLog() method
|
||||
|
||||
Disables logging for the given function.
|
||||
Disables logging for the given NS function.
|
||||
|
||||
**Signature:**
|
||||
|
||||
@ -16,7 +16,7 @@ disableLog(fn: string): void;
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| fn | string | Name of function for which to disable logging. |
|
||||
| fn | string | Name of the NS function for which to disable logging. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
@ -30,3 +30,11 @@ Logging can be disabled for all functions by passing `ALL` as the argument.
|
||||
|
||||
For specific interfaces, use the form "namespace.functionName". (e.g. "ui.setTheme")
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
ns.disableLog("hack"); // Disable logging for `ns.hack()`
|
||||
|
||||
```
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
## NS.enableLog() method
|
||||
|
||||
Enable logging for a certain function.
|
||||
Enables logging for the given NS function.
|
||||
|
||||
**Signature:**
|
||||
|
||||
@ -16,7 +16,7 @@ enableLog(fn: string): void;
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| fn | string | Name of function for which to enable logging. |
|
||||
| fn | string | Name of the NS function for which to enable logging. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
@ -26,5 +26,13 @@ void
|
||||
|
||||
RAM cost: 0 GB
|
||||
|
||||
Re-enables logging for the given function. If `ALL` is passed into this function as an argument, then it will revert the effects of disableLog(`ALL`<!-- -->).
|
||||
Re-enables logging for the given function. If `ALL` is passed into this function as an argument, it will revert the effect of disableLog("ALL").
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
ns.enableLog("hack"); // Enable logging for `ns.hack()`
|
||||
|
||||
```
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
## NS.isLogEnabled() method
|
||||
|
||||
Checks the status of the logging for the given function.
|
||||
Checks the status of the logging for the given NS function.
|
||||
|
||||
**Signature:**
|
||||
|
||||
@ -22,9 +22,17 @@ isLogEnabled(fn: string): boolean;
|
||||
|
||||
boolean
|
||||
|
||||
Returns a boolean indicating whether or not logging is enabled for that function (or `ALL`<!-- -->).
|
||||
Returns a boolean indicating whether or not logging is enabled for that NS function (or `ALL`<!-- -->).
|
||||
|
||||
## Remarks
|
||||
|
||||
RAM cost: 0 GB
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
ns.print(ns.isLogEnabled("hack")); // Check if logging is enabled for `ns.hack()`
|
||||
|
||||
```
|
||||
|
||||
|
@ -63,8 +63,8 @@ export async function main(ns) {
|
||||
| [clearPort(portNumber)](./bitburner.ns.clearport.md) | Clear data from a port. |
|
||||
| [closeTail(pid)](./bitburner.ns.closetail.md) | Close the tail window of a script. |
|
||||
| [deleteServer(host)](./bitburner.ns.deleteserver.md) | Delete a purchased server. |
|
||||
| [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given function. |
|
||||
| [enableLog(fn)](./bitburner.ns.enablelog.md) | Enable logging for a certain function. |
|
||||
| [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given NS function. |
|
||||
| [enableLog(fn)](./bitburner.ns.enablelog.md) | Enables logging for the given NS function. |
|
||||
| [exec(script, hostname, threadOrOptions, args)](./bitburner.ns.exec.md) | Start another script on any server. |
|
||||
| [exit()](./bitburner.ns.exit.md) | Terminates the current script immediately. |
|
||||
| [fileExists(filename, host)](./bitburner.ns.fileexists.md) | Check if a file exists. |
|
||||
@ -125,7 +125,7 @@ export async function main(ns) {
|
||||
| [hasRootAccess(host)](./bitburner.ns.hasrootaccess.md) | Check if you have root access on a server. |
|
||||
| [hasTorRouter()](./bitburner.ns.hastorrouter.md) | Returns whether the player has access to the darkweb. |
|
||||
| [httpworm(host)](./bitburner.ns.httpworm.md) | Runs HTTPWorm.exe on a server. |
|
||||
| [isLogEnabled(fn)](./bitburner.ns.islogenabled.md) | Checks the status of the logging for the given function. |
|
||||
| [isLogEnabled(fn)](./bitburner.ns.islogenabled.md) | Checks the status of the logging for the given NS function. |
|
||||
| [isRunning(script, host, args)](./bitburner.ns.isrunning.md) | Check if a script is running. |
|
||||
| [kill(pid)](./bitburner.ns.kill.md) | Terminate the script with the provided PID. |
|
||||
| [kill(filename, hostname, args)](./bitburner.ns.kill_1.md) | Terminate the script(s) with the provided filename, hostname, and script arguments. |
|
||||
|
37
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
37
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -5840,7 +5840,8 @@ export interface NS {
|
||||
clearLog(): void;
|
||||
|
||||
/**
|
||||
* Disables logging for the given function.
|
||||
* Disables logging for the given NS function.
|
||||
*
|
||||
* @remarks
|
||||
* RAM cost: 0 GB
|
||||
*
|
||||
@ -5848,29 +5849,49 @@ export interface NS {
|
||||
*
|
||||
* For specific interfaces, use the form "namespace.functionName". (e.g. "ui.setTheme")
|
||||
*
|
||||
* @param fn - Name of function for which to disable logging.
|
||||
* @example
|
||||
* ```js
|
||||
* ns.disableLog("hack"); // Disable logging for `ns.hack()`
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @param fn - Name of the NS function for which to disable logging.
|
||||
*/
|
||||
disableLog(fn: string): void;
|
||||
|
||||
/**
|
||||
* Enable logging for a certain function.
|
||||
* Enables logging for the given NS function.
|
||||
*
|
||||
* @remarks
|
||||
* RAM cost: 0 GB
|
||||
*
|
||||
* Re-enables logging for the given function. If `ALL` is passed into this
|
||||
* function as an argument, then it will revert the effects of disableLog(`ALL`).
|
||||
* Re-enables logging for the given function. If `ALL` is passed into this function as an argument, it will revert the
|
||||
* effect of disableLog("ALL").
|
||||
*
|
||||
* @param fn - Name of function for which to enable logging.
|
||||
* @example
|
||||
* ```js
|
||||
* ns.enableLog("hack"); // Enable logging for `ns.hack()`
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @param fn - Name of the NS function for which to enable logging.
|
||||
*/
|
||||
enableLog(fn: string): void;
|
||||
|
||||
/**
|
||||
* Checks the status of the logging for the given function.
|
||||
* Checks the status of the logging for the given NS function.
|
||||
*
|
||||
* @remarks
|
||||
* RAM cost: 0 GB
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* ns.print(ns.isLogEnabled("hack")); // Check if logging is enabled for `ns.hack()`
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @param fn - Name of function to check.
|
||||
* @returns Returns a boolean indicating whether or not logging is enabled for that function (or `ALL`).
|
||||
* @returns Returns a boolean indicating whether or not logging is enabled for that NS function (or `ALL`).
|
||||
*/
|
||||
isLogEnabled(fn: string): boolean;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user