mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
all: Refactor to non-global logger
Note that this looks like overkill for just the logger, and that is correct, but this will make sense once we start with the template handling etc. Updates #2701
This commit is contained in:
parent
24a286791f
commit
45e3ed517a
42 changed files with 410 additions and 320 deletions
|
@ -104,7 +104,8 @@ func init() {
|
|||
}
|
||||
|
||||
func server(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(serverCmd); err != nil {
|
||||
cfg, err := InitializeConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -118,7 +119,7 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
|
||||
if viper.GetBool("watch") {
|
||||
serverWatch = true
|
||||
watchConfig()
|
||||
watchConfig(cfg)
|
||||
}
|
||||
|
||||
l, err := net.Listen("tcp", net.JoinHostPort(serverInterface, strconv.Itoa(serverPort)))
|
||||
|
@ -161,7 +162,7 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
viper.Set("publishDir", "/")
|
||||
}
|
||||
|
||||
if err := build(serverWatch); err != nil {
|
||||
if err := build(cfg, serverWatch); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
rootWatchDirs := strings.Join(helpers.UniqueStrings(helpers.ExtractRootPaths(watchDirs)), ",")
|
||||
|
||||
jww.FEEDBACK.Printf("Watching for changes in %s%s{%s}\n", baseWatchDir, helpers.FilePathSeparator, rootWatchDirs)
|
||||
err := NewWatcher(serverPort)
|
||||
err := newWatcher(cfg, serverPort)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue