mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 05:14:26 -05:00
Add missing logging context at various places
Our custom logger supports providing the name of the function that calls the logger, this commit adds this context string where it was previously missing. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
0dbcc9a653
commit
99ddee7815
3 changed files with 11 additions and 7 deletions
|
@ -54,7 +54,7 @@ export class NotesController {
|
||||||
@MarkdownBody() text: string,
|
@MarkdownBody() text: string,
|
||||||
): Promise<NoteDto> {
|
): Promise<NoteDto> {
|
||||||
// ToDo: provide user for createNoteDto
|
// ToDo: provide user for createNoteDto
|
||||||
this.logger.debug('Got raw markdown:\n' + text);
|
this.logger.debug('Got raw markdown:\n' + text, 'createNote');
|
||||||
return this.noteService.toNoteDto(
|
return this.noteService.toNoteDto(
|
||||||
await this.noteService.createNote(text, undefined, req.user),
|
await this.noteService.createNote(text, undefined, req.user),
|
||||||
);
|
);
|
||||||
|
@ -84,7 +84,7 @@ export class NotesController {
|
||||||
@MarkdownBody() text: string,
|
@MarkdownBody() text: string,
|
||||||
): Promise<NoteDto> {
|
): Promise<NoteDto> {
|
||||||
// ToDo: check if user is allowed to view this note
|
// ToDo: check if user is allowed to view this note
|
||||||
this.logger.debug('Got raw markdown:\n' + text);
|
this.logger.debug('Got raw markdown:\n' + text, 'createNamedNote');
|
||||||
return this.noteService.toNoteDto(
|
return this.noteService.toNoteDto(
|
||||||
await this.noteService.createNote(text, noteAlias, req.user),
|
await this.noteService.createNote(text, noteAlias, req.user),
|
||||||
);
|
);
|
||||||
|
@ -97,7 +97,7 @@ export class NotesController {
|
||||||
@Param('noteIdOrAlias') noteIdOrAlias: string,
|
@Param('noteIdOrAlias') noteIdOrAlias: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// ToDo: check if user is allowed to delete this note
|
// ToDo: check if user is allowed to delete this note
|
||||||
this.logger.debug('Deleting note: ' + noteIdOrAlias);
|
this.logger.debug('Deleting note: ' + noteIdOrAlias, 'deleteNote');
|
||||||
try {
|
try {
|
||||||
await this.noteService.deleteNoteByIdOrAlias(noteIdOrAlias);
|
await this.noteService.deleteNoteByIdOrAlias(noteIdOrAlias);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -106,7 +106,7 @@ export class NotesController {
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
this.logger.debug('Successfully deleted ' + noteIdOrAlias);
|
this.logger.debug('Successfully deleted ' + noteIdOrAlias, 'deleteNote');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ export class NotesController {
|
||||||
@MarkdownBody() text: string,
|
@MarkdownBody() text: string,
|
||||||
): Promise<NoteDto> {
|
): Promise<NoteDto> {
|
||||||
// ToDo: check if user is allowed to change this note
|
// ToDo: check if user is allowed to change this note
|
||||||
this.logger.debug('Got raw markdown:\n' + text);
|
this.logger.debug('Got raw markdown:\n' + text, 'updateNote');
|
||||||
try {
|
try {
|
||||||
return this.noteService.toNoteDto(
|
return this.noteService.toNoteDto(
|
||||||
await this.noteService.updateNoteByIdOrAlias(noteIdOrAlias, text),
|
await this.noteService.updateNoteByIdOrAlias(noteIdOrAlias, text),
|
||||||
|
|
|
@ -224,13 +224,17 @@ export class AuthService {
|
||||||
let removedTokens = 0;
|
let removedTokens = 0;
|
||||||
for (const token of tokens) {
|
for (const token of tokens) {
|
||||||
if (token.validUntil && token.validUntil.getTime() <= currentTime) {
|
if (token.validUntil && token.validUntil.getTime() <= currentTime) {
|
||||||
this.logger.debug(`AuthToken '${token.keyId}' was removed`);
|
this.logger.debug(
|
||||||
|
`AuthToken '${token.keyId}' was removed`,
|
||||||
|
'removeInvalidTokens',
|
||||||
|
);
|
||||||
await this.authTokenRepository.remove(token);
|
await this.authTokenRepository.remove(token);
|
||||||
removedTokens++;
|
removedTokens++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
`${removedTokens} invalid AuthTokens were purged from the DB.`,
|
`${removedTokens} invalid AuthTokens were purged from the DB.`,
|
||||||
|
'removeInvalidTokens',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ export class NotesService {
|
||||||
noteIdOrAlias: string,
|
noteIdOrAlias: string,
|
||||||
newPermissions: NotePermissionsUpdateDto,
|
newPermissions: NotePermissionsUpdateDto,
|
||||||
): Note {
|
): Note {
|
||||||
this.logger.warn('Using hardcoded data!');
|
this.logger.warn('Using hardcoded data!', 'updateNotePermissions');
|
||||||
return {
|
return {
|
||||||
id: 'foobar-barfoo',
|
id: 'foobar-barfoo',
|
||||||
alias: null,
|
alias: null,
|
||||||
|
|
Loading…
Reference in a new issue