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

Improve dev first use log messages #489

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ In previous releases, the name "Hypermode" was used for all three._
- Add `.gitignore` files to default templates [#486](https://github.com/hypermodeinc/modus/pull/486)
- Fix CLI warnings about Go/TinyGo installation [#487](https://github.com/hypermodeinc/modus/pull/487)
- Remove deprecated model fields [#488](https://github.com/hypermodeinc/modus/pull/488)
- Improve dev first use log messages [#489](https://github.com/hypermodeinc/modus/pull/489)

## 2024-10-02 - Version 0.12.7

Expand Down
1 change: 0 additions & 1 deletion cli/src/commands/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ export default class DevCommand extends Command {
// NOTE: The built-in fs.watch or fsPromises.watch is insufficient for our needs.
// Instead, we use chokidar for consistent behavior in cross-platform file watching.
const ignoredPaths = [path.join(appPath, "build") + path.sep, path.join(appPath, "node_modules") + path.sep];
this.log(chalk.dim("Ignoring paths:"), ignoredPaths);
chokidar
.watch(appPath, {
ignored: (filePath, stats) => (stats?.isFile() || true) && ignoredPaths.some((p) => path.normalize(filePath).startsWith(p)),
Expand Down
7 changes: 5 additions & 2 deletions runtime/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"time"

"github.com/hypermodeinc/modus/lib/manifest"
"github.com/hypermodeinc/modus/runtime/config"
"github.com/hypermodeinc/modus/runtime/logger"
"github.com/hypermodeinc/modus/runtime/metrics"
"github.com/hypermodeinc/modus/runtime/plugins"
Expand Down Expand Up @@ -243,7 +244,9 @@ func logDbWarningOrError(ctx context.Context, err error, msg string) {
if _, ok := err.(*pgconn.ConnectError); ok {
logger.Warn(ctx).Err(err).Msgf("Database connection error. %s", msg)
} else if errors.Is(err, errDbNotConfigured) {
logger.Warn(ctx).Msgf("Database has not been configured. %s", msg)
if !config.IsDevEnvironment() {
logger.Warn(ctx).Msgf("Database has not been configured. %s", msg)
}
} else {
logger.Err(ctx, err).Msg(msg)
}
Expand Down Expand Up @@ -663,7 +666,7 @@ VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
func Initialize(ctx context.Context) {
// this will initialize the pool and start the worker
_, err := globalRuntimePostgresWriter.GetPool(ctx)
if err != nil {
if err != nil && !config.IsDevEnvironment() {
logger.Warn(ctx).Err(err).Msg("Metadata database is not available.")
}
go globalRuntimePostgresWriter.worker(ctx)
Expand Down
15 changes: 5 additions & 10 deletions runtime/manifestdata/manifestdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,16 @@ func SetManifest(m *manifest.Manifest) {

func MonitorManifestFile(ctx context.Context) {
loadFile := func(file storage.FileInfo) error {
logger.Info(ctx).Str("filename", file.Name).Msg("Loading manifest file.")
if file.Name != manifestFileName {
return nil
}
err := loadManifest(ctx)
if err == nil {
logger.Info(ctx).
Str("filename", file.Name).
Msg("Loaded manifest file.")
} else {
logger.Err(ctx, err).
Str("filename", file.Name).
Msg("Failed to load manifest file.")

if err := loadManifest(ctx); err != nil {
logger.Err(ctx, err).Str("filename", file.Name).Msg("Failed to load manifest file.")
}

return err
return nil
}

// NOTE: Removing the manifest file entirely is not currently supported.
Expand Down
Loading