Skip to content

Commit

Permalink
feat: accept logging path name as identifier (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Mar 15, 2023
1 parent 45efe32 commit 9b164dc
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit 9b164dc

Please sign in to comment.