mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 21:57:54 +00:00
events: Allow system messages to not be tracked
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
c211efe399
commit
83d53cfb56
@ -113,17 +113,20 @@ export class Logger {
|
|||||||
message: string,
|
message: string,
|
||||||
eventObj?: LogEventObject,
|
eventObj?: LogEventObject,
|
||||||
eventName?: string,
|
eventName?: string,
|
||||||
|
track: boolean = true,
|
||||||
) {
|
) {
|
||||||
const msgObj: LogMessage = { message, isSystem: true };
|
const msgObj: LogMessage = { message, isSystem: true };
|
||||||
if (eventObj != null && eventObj.error != null) {
|
if (eventObj != null && eventObj.error != null) {
|
||||||
msgObj.isStdErr = true;
|
msgObj.isStdErr = true;
|
||||||
}
|
}
|
||||||
this.log(msgObj);
|
this.log(msgObj);
|
||||||
|
if (track) {
|
||||||
this.eventTracker.track(
|
this.eventTracker.track(
|
||||||
eventName != null ? eventName : message,
|
eventName != null ? eventName : message,
|
||||||
eventObj != null ? eventObj : {},
|
eventObj != null ? eventObj : {},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public lock(containerId: string): Bluebird.Disposer<() => void> {
|
public lock(containerId: string): Bluebird.Disposer<() => void> {
|
||||||
return writeLock(containerId).disposer(release => {
|
return writeLock(containerId).disposer(release => {
|
||||||
@ -153,7 +156,11 @@ export class Logger {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public logSystemEvent(logType: LogType, obj: LogEventObject): void {
|
public logSystemEvent(
|
||||||
|
logType: LogType,
|
||||||
|
obj: LogEventObject,
|
||||||
|
track: boolean = true,
|
||||||
|
): void {
|
||||||
let message = logType.humanName;
|
let message = logType.humanName;
|
||||||
const objectName = this.objectNameForLogs(obj);
|
const objectName = this.objectNameForLogs(obj);
|
||||||
if (objectName != null) {
|
if (objectName != null) {
|
||||||
@ -168,7 +175,7 @@ export class Logger {
|
|||||||
}
|
}
|
||||||
message += ` due to '${errorMessage}'`;
|
message += ` due to '${errorMessage}'`;
|
||||||
}
|
}
|
||||||
this.logSystemMessage(message, obj, logType.eventName);
|
this.logSystemMessage(message, obj, logType.eventName, track);
|
||||||
}
|
}
|
||||||
|
|
||||||
public logConfigChange(
|
public logConfigChange(
|
||||||
|
Loading…
Reference in New Issue
Block a user