Skip to content

Commit a227372

Browse files
Set watchfiles log level to WARNING (#403)
1 parent c78ecb8 commit a227372

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

plugins/contents/fps_contents/fileid.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
from jupyverse_api import Singleton
1111

12-
logger = logging.getLogger("contents")
12+
contents_logger = logging.getLogger("contents")
13+
watchfiles_logger = logging.getLogger("watchfiles")
14+
watchfiles_logger.setLevel(logging.WARNING)
1315

1416

1517
class Watcher:
@@ -110,13 +112,13 @@ async def watch_files(self):
110112
changed_path_str = str(changed_path)
111113

112114
if change == Change.deleted:
113-
logger.debug("File %s was deleted", changed_path_str)
115+
contents_logger.debug("File %s was deleted", changed_path_str)
114116
async with db.execute(
115117
"SELECT COUNT(*) FROM fileids WHERE path = ?", (changed_path_str,)
116118
) as cursor:
117119
if not (await cursor.fetchone())[0]:
118120
# path is not indexed, ignore
119-
logger.debug(
121+
contents_logger.debug(
120122
"File %s is not indexed, ignoring", changed_path_str
121123
)
122124
continue
@@ -125,20 +127,20 @@ async def watch_files(self):
125127
db, changed_path_str, deleted_paths, added_paths, False
126128
)
127129
elif change == Change.added:
128-
logger.debug("File %s was added", changed_path_str)
130+
contents_logger.debug("File %s was added", changed_path_str)
129131
await maybe_rename(
130132
db, changed_path_str, added_paths, deleted_paths, True
131133
)
132134
elif change == Change.modified:
133-
logger.debug("File %s was modified", changed_path_str)
135+
contents_logger.debug("File %s was modified", changed_path_str)
134136
if changed_path_str == self.db_path:
135137
continue
136138
async with db.execute(
137139
"SELECT COUNT(*) FROM fileids WHERE path = ?", (changed_path_str,)
138140
) as cursor:
139141
if not (await cursor.fetchone())[0]:
140142
# path is not indexed, ignore
141-
logger.debug(
143+
contents_logger.debug(
142144
"File %s is not indexed, ignoring", changed_path_str
143145
)
144146
continue
@@ -149,7 +151,7 @@ async def watch_files(self):
149151
)
150152

151153
for path in deleted_paths - added_paths:
152-
logger.debug("Unindexing file %s ", path)
154+
contents_logger.debug("Unindexing file %s ", path)
153155
await db.execute("DELETE FROM fileids WHERE path = ?", (path,))
154156
await db.commit()
155157

@@ -203,7 +205,7 @@ async def maybe_rename(
203205
path1, path2 = changed_path, other_path
204206
if is_added_path:
205207
path1, path2 = path2, path1
206-
logger.debug("File %s was renamed to %s", path1, path2)
208+
contents_logger.debug("File %s was renamed to %s", path1, path2)
207209
await db.execute("UPDATE fileids SET path = ? WHERE path = ?", (path2, path1))
208210
other_paths.remove(other_path)
209211
return

0 commit comments

Comments
 (0)