Skip to content
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

feat: accept logging path name as identifier #189

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ class ClinicFlame extends events.EventEmitter {
detectPort = false,
debug = false,
dest = null,
kernelTracing = false
kernelTracing = false,
name,
} = settings

this.detectPort = detectPort
this.debug = debug
this.path = dest
this.kernelTracing = kernelTracing
this.startTime = 0;
this.elapsedTime = 0;
this.startTime = 0
this.elapsedTime = 0
this.name = name
}

collect (args, cb) {
Expand All @@ -40,7 +42,8 @@ class ClinicFlame extends events.EventEmitter {

const paths = getLoggingPaths({
path: this.path,
identifier: '{pid}' // replaced with actual pid by 0x
identifier: this.name || '{pid}',
// '{pid}' is replaced with actual pid by 0x
})

this.startTime = performance.now()
Expand Down Expand Up @@ -84,7 +87,10 @@ class ClinicFlame extends events.EventEmitter {
})
}

const paths = getLoggingPaths({ path: self.path, identifier: pid })
// When a name is provided, an override is expected.
// So, there's no need to pass the identifier
const paths = getLoggingPaths({ path: self.path, identifier: self.name || pid })

fs.writeFile(paths['/systeminfo'], JSON.stringify(systemInfo(paths['/0x-data/']), null, 2), next)
fs.writeFile(paths['/inlinedfunctions'], JSON.stringify(inlinedFunctions(paths['/0x-data/'])), next)

Expand Down