mirror of
https://github.com/danog/gllvm.git
synced 2024-11-30 04:09:02 +01:00
Added an new AUDIT logging level betwix WARNING and INFO that just logs the calls.
This commit is contained in:
parent
ea18e036f8
commit
ede7a49a98
@ -175,6 +175,7 @@ variable to one of the following levels:
|
|||||||
|
|
||||||
* `ERROR`
|
* `ERROR`
|
||||||
* `WARNING`
|
* `WARNING`
|
||||||
|
* `AUDIT`
|
||||||
* `INFO`
|
* `INFO`
|
||||||
* `DEBUG`
|
* `DEBUG`
|
||||||
|
|
||||||
@ -184,6 +185,8 @@ For example:
|
|||||||
```
|
```
|
||||||
Output will be directed to the standard error stream, unless you specify the
|
Output will be directed to the standard error stream, unless you specify the
|
||||||
path of a logfile via the `WLLVM_OUTPUT_FILE` environment variable.
|
path of a logfile via the `WLLVM_OUTPUT_FILE` environment variable.
|
||||||
|
The `AUDIT` level, new in 2022, logs only the calls to the compiler, and indicates
|
||||||
|
whether each call is *compiling* or *linking*, the compiler used, and the arguments provided.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
```
|
```
|
||||||
|
@ -312,12 +312,12 @@ func execCompile(compilerExecName string, pr ParserResult, wg *sync.WaitGroup, o
|
|||||||
// But for the now, we just remove forbidden arguments
|
// But for the now, we just remove forbidden arguments
|
||||||
var success bool
|
var success bool
|
||||||
var err error
|
var err error
|
||||||
var linking = false
|
var mode = "COMPILING"
|
||||||
// start afresh
|
// start afresh
|
||||||
arguments := []string{}
|
arguments := []string{}
|
||||||
// we are linking rather than compiling
|
// we are linking rather than compiling
|
||||||
if len(pr.InputFiles) == 0 && len(pr.LinkArgs) > 0 {
|
if len(pr.InputFiles) == 0 && len(pr.LinkArgs) > 0 {
|
||||||
linking = true
|
mode = "LINKING"
|
||||||
if pr.IsLTO {
|
if pr.IsLTO {
|
||||||
arguments = append(arguments, LLVMLtoLDFLAGS...)
|
arguments = append(arguments, LLVMLtoLDFLAGS...)
|
||||||
}
|
}
|
||||||
@ -339,11 +339,7 @@ func execCompile(compilerExecName string, pr ParserResult, wg *sync.WaitGroup, o
|
|||||||
} else {
|
} else {
|
||||||
arguments = append(arguments, pr.InputList...)
|
arguments = append(arguments, pr.InputList...)
|
||||||
}
|
}
|
||||||
if linking {
|
LogAudit("%v %v %v", mode, compilerExecName, arguments)
|
||||||
LogInfo("LINKING with %v using %v", compilerExecName, arguments)
|
|
||||||
} else {
|
|
||||||
LogInfo("COMPILING with %v using %v", compilerExecName, arguments)
|
|
||||||
}
|
|
||||||
LogDebug("Calling execCmd(%v, %v)", compilerExecName, arguments)
|
LogDebug("Calling execCmd(%v, %v)", compilerExecName, arguments)
|
||||||
success, err = execCmd(compilerExecName, arguments, "")
|
success, err = execCmd(compilerExecName, arguments, "")
|
||||||
if !success {
|
if !success {
|
||||||
|
@ -42,6 +42,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
errorV = iota
|
errorV = iota
|
||||||
warningV
|
warningV
|
||||||
|
auditV
|
||||||
infoV
|
infoV
|
||||||
debugV
|
debugV
|
||||||
)
|
)
|
||||||
@ -50,6 +51,7 @@ const (
|
|||||||
var loggingLevels = map[string]int{
|
var loggingLevels = map[string]int{
|
||||||
"ERROR": errorV,
|
"ERROR": errorV,
|
||||||
"WARNING": warningV,
|
"WARNING": warningV,
|
||||||
|
"AUDIT": auditV,
|
||||||
"INFO": infoV,
|
"INFO": infoV,
|
||||||
"DEBUG": debugV,
|
"DEBUG": debugV,
|
||||||
}
|
}
|
||||||
@ -57,11 +59,12 @@ var loggingLevels = map[string]int{
|
|||||||
var loggingPrefixes = map[int]string{
|
var loggingPrefixes = map[int]string{
|
||||||
errorV: "ERROR:",
|
errorV: "ERROR:",
|
||||||
warningV: "WARNING:",
|
warningV: "WARNING:",
|
||||||
|
auditV: "AUDIT:",
|
||||||
infoV: "INFO:",
|
infoV: "INFO:",
|
||||||
debugV: "DEBUG:",
|
debugV: "DEBUG:",
|
||||||
}
|
}
|
||||||
|
|
||||||
// loggingLevel is the user configured level of logging: ERROR, WARNING, INFO, DEBUG
|
// loggingLevel is the user configured level of logging: ERROR, WARNING, AUDIT, INFO, DEBUG
|
||||||
var loggingLevel = warningV
|
var loggingLevel = warningV
|
||||||
|
|
||||||
// loggingFilePointer is where the logging is streamed too.
|
// loggingFilePointer is where the logging is streamed too.
|
||||||
@ -114,6 +117,9 @@ var LogInfo = makeLogger(infoV)
|
|||||||
// LogWarning logs to the configured stream if the logging level is WARNING or lower.
|
// LogWarning logs to the configured stream if the logging level is WARNING or lower.
|
||||||
var LogWarning = makeLogger(warningV)
|
var LogWarning = makeLogger(warningV)
|
||||||
|
|
||||||
|
// LogAudit logs to the configured stream if the logging level is AUDIT or lower.
|
||||||
|
var LogAudit = makeLogger(auditV)
|
||||||
|
|
||||||
// LogError logs to the configured stream if the logging level is ERROR or lower.
|
// LogError logs to the configured stream if the logging level is ERROR or lower.
|
||||||
var LogError = makeLogger(errorV)
|
var LogError = makeLogger(errorV)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user