mirror of
https://github.com/lxc/distrobuilder.git
synced 2026-02-05 15:46:17 +01:00
Introduce functionality to parse `/etc/passwd` and `/etc/group` files to map symbolic user/group names to numeric IDs. This ensures consistency in file definitions by replacing symbolic references with their corresponding numeric IDs in the global configuration. An environment override for logger colors was also added. Signed-off-by: Arthur <git@arthur.pro>
30 lines
455 B
Go
30 lines
455 B
Go
package shared
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// GetLogger returns a new logger.
|
|
func GetLogger(debug bool) (*logrus.Logger, error) {
|
|
logger := logrus.StandardLogger()
|
|
|
|
logger.SetOutput(os.Stdout)
|
|
|
|
formatter := logrus.TextFormatter{
|
|
FullTimestamp: true,
|
|
PadLevelText: true,
|
|
}
|
|
|
|
formatter.EnvironmentOverrideColors = true
|
|
|
|
logger.Formatter = &formatter
|
|
|
|
if debug {
|
|
logger.Level = logrus.DebugLevel
|
|
}
|
|
|
|
return logger, nil
|
|
}
|