-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(*): update logger functionally to support configurable IP lo…
…gging 1. modified the logger functions in logger.ts to accept an options parameter, allowing for the configuration of IP logging , 2. move all files in types folder to types.ts
- Loading branch information
Showing
21 changed files
with
96 additions
and
201 deletions.
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
This file was deleted.
Oops, something went wrong.
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,60 @@ | ||
interface RequestInfo { | ||
headers: { get: (key: string) => any } | ||
method: string | ||
url: string | ||
} | ||
|
||
interface Server { | ||
hostname?: string | ||
port?: number | ||
protocol?: string | ||
} | ||
|
||
interface ColorMap { | ||
[key: string]: (str: string) => string | ||
} | ||
|
||
type LogLevel = 'INFO' | 'WARNING' | 'ERROR' | string | ||
|
||
interface LogData { | ||
status?: number | ||
message?: string | ||
} | ||
|
||
interface Logger { | ||
log( | ||
level: LogLevel, | ||
request: RequestInfo, | ||
data: LogData, | ||
store: StoreData | ||
): void | ||
} | ||
|
||
interface StoreData { | ||
beforeTime: bigint | ||
} | ||
|
||
class HttpError extends Error { | ||
status: number | ||
|
||
constructor(status: number, message: string) { | ||
super(message) | ||
this.status = status | ||
} | ||
} | ||
|
||
interface Options { | ||
ip?: boolean | ||
} | ||
|
||
export { | ||
RequestInfo, | ||
Server, | ||
ColorMap, | ||
LogLevel, | ||
LogData, | ||
Logger, | ||
StoreData, | ||
HttpError, | ||
Options | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Server } from '~/types/Server' | ||
import { Server } from '~/types' | ||
|
||
/** | ||
* Creates a box text. | ||
|
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
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
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
Oops, something went wrong.