-
Notifications
You must be signed in to change notification settings - Fork 10
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
TS types #27
base: master
Are you sure you want to change the base?
TS types #27
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,10 @@ | |
"journald" | ||
], | ||
"author": "Jue <[email protected]>", | ||
"contributors": ["Mikel Pérez <[email protected]>"], | ||
"license": "MIT", | ||
"main": "index.js", | ||
"types": "types/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jue89/node-systemd-journald.git" | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,42 @@ | ||||||
declare module "systemd-journald" { | ||||||
// https://man7.org/linux/man-pages/man7/systemd.journal-fields.7.html | ||||||
export type JournalFields = { | ||||||
message_id?: string, | ||||||
code_file?: string, | ||||||
code_line?: string, | ||||||
code_func?: string, | ||||||
errno?: string, | ||||||
invocation_id?: string, | ||||||
user_invocation_id?: string, | ||||||
syslog_facility?: string, | ||||||
syslog_identifier?: string, | ||||||
syslog_pid?: string, | ||||||
syslog_timestamp?: string, | ||||||
syslog_raw?: string, | ||||||
documentation?: string, | ||||||
tid?: string, | ||||||
unit?: string, | ||||||
user_unit?: string | ||||||
} | ||||||
|
||||||
export default class systemd_journald { | ||||||
constructor(defaultFields: JournalFields); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Just guesstimating here :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my reasoning was that you wouldn't instantiate it and would use the static methods if you didn't want to provide defaults. |
||||||
|
||||||
alert(message: string, fields?: JournalFields): void; | ||||||
crit(message: string, fields?: JournalFields): void; | ||||||
debug(message: string, fields?: JournalFields): void; | ||||||
emerg(message: string, fields?: JournalFields): void; | ||||||
err(message: string, fields?: JournalFields): void; | ||||||
info(message: string, fields?: JournalFields): void; | ||||||
notice(message: string, fields?: JournalFields): void; | ||||||
warning(message: string, fields?: JournalFields): void; | ||||||
static alert(message: string, fields?: JournalFields): void; | ||||||
static crit(message: string, fields?: JournalFields): void; | ||||||
static debug(message: string, fields?: JournalFields): void; | ||||||
static emerg(message: string, fields?: JournalFields): void; | ||||||
static err(message: string, fields?: JournalFields): void; | ||||||
static info(message: string, fields?: JournalFields): void; | ||||||
static notice(message: string, fields?: JournalFields): void; | ||||||
static warning(message: string, fields?: JournalFields): void; | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not a TS expert. Does this definition allow for custom fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no! it doesn't
we can add a
[custom: string]: string
, let me get around thatThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added on 40e7073, also replaced all ? with Partial