-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cff4ed
commit 794492e
Showing
6 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** @noSelfInFile */ | ||
|
||
import { LogConfig } from './LogConfig'; | ||
import { Log } from './LogType'; | ||
|
||
/** | ||
* Configure logging options. | ||
* | ||
* Note that calling `log.cfg()` before `box.cfg()` takes into account logging options specified using environment variables, | ||
* such as `TT_LOG` and `TT_LOG_LEVEL`. | ||
* @param cfg Logging configuration table. | ||
*/ | ||
export declare function cfg(cfg: LogConfig): void; | ||
|
||
/** | ||
* @param message A log message. | ||
* - A message can be a string. | ||
* - A message may contain C-style format specifiers `%d` or `%s`. | ||
* - A message may be a scalar data type or a table. | ||
* @param args Arguments to pass to message. | ||
*/ | ||
export declare function error(message: unknown, ...args: unknown[]): void; | ||
|
||
/** | ||
* @param message A log message. | ||
* - A message can be a string. | ||
* - A message may contain C-style format specifiers `%d` or `%s`. | ||
* - A message may be a scalar data type or a table. | ||
* @param args Arguments to pass to message. | ||
*/ | ||
export declare function warn(message: unknown, ...args: unknown[]): void; | ||
|
||
/** | ||
* @param message A log message. | ||
* - A message can be a string. | ||
* - A message may contain C-style format specifiers `%d` or `%s`. | ||
* - A message may be a scalar data type or a table. | ||
* @param args Arguments to pass to message. | ||
*/ | ||
export declare function info(message: unknown, ...args: unknown[]): void; | ||
|
||
/** | ||
* @param message A log message. | ||
* - A message can be a string. | ||
* - A message may contain C-style format specifiers `%d` or `%s`. | ||
* - A message may be a scalar data type or a table. | ||
* @param args Arguments to pass to message. | ||
*/ | ||
export declare function verbose(message: unknown, ...args: unknown[]): void; | ||
|
||
/** | ||
* @param message A log message. | ||
* - A message can be a string. | ||
* - A message may contain C-style format specifiers `%d` or `%s`. | ||
* - A message may be a scalar data type or a table. | ||
* @param args Arguments to pass to message. | ||
*/ | ||
export declare function debug(message: unknown, ...args: unknown[]): void; | ||
|
||
/** | ||
* @returns A PID of a logger. You can use this PID to send a signal to a log rotation program, so it can rotate logs. | ||
*/ | ||
export declare function pid(): number; | ||
|
||
/** | ||
* Rotate the log. | ||
* For example, you need to call this function to continue logging after a log rotation program renames or moves a file with the latest logs. | ||
*/ | ||
export declare function rotate(): void; | ||
|
||
/** | ||
* Create a new logger with the specified name. You can configure a specific log level for a new logger using the log_modules configuration property. | ||
* @param name A logger name. | ||
* @returns A logger instance. | ||
* @customName new | ||
*/ | ||
export declare function new_(name: string): typeof Log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export interface LogConfig { | ||
/** | ||
* Specifies the level of detail the log has. | ||
*/ | ||
level?: LogLevel; | ||
|
||
/** | ||
* Specifies where to send the log’s output, for example, to a file, pipe, or system logger. | ||
*/ | ||
log?: string; | ||
|
||
/** | ||
* If true, Tarantool does not block during logging when the system is not ready for writing, and drops the message instead. | ||
*/ | ||
nonblock?: boolean; | ||
|
||
/** | ||
* Specifies the log format: `plain` or `json`. | ||
*/ | ||
format?: 'plain' | 'json'; | ||
|
||
/** | ||
* Configures the specified log levels for different modules. | ||
*/ | ||
modules?: { [key: string]: LogLevel }; | ||
} | ||
|
||
export type LogLevel = | ||
| 1 | 'syserror' | ||
| 2 | 'error' | ||
| 3 | 'crit' | ||
| 4 | 'warn' | ||
| 5 | 'info' | ||
| 6 | 'verbose' | ||
| 7 | 'debug'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * as Log from './Log'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './LogConfig'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './builtin/log/Log'; |