Skip to content

Commit

Permalink
Merge pull request #481 from Jafaral/logger
Browse files Browse the repository at this point in the history
ulsp: move the logger to a separate file
  • Loading branch information
Don-Ward authored Sep 22, 2024
2 parents 999adae + 5e84c8e commit 765c8bb
Show file tree
Hide file tree
Showing 5 changed files with 369 additions and 299 deletions.
12 changes: 5 additions & 7 deletions uni/ulsp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ UFLAGS=-s -u

prog=ulsp

SRC=launch-lsp.icn workspace.icn database.icn server.icn completion.icn signature.icn hover.icn definition.icn
OBJ=launch-lsp.u workspace.u database.u server.u completion.u signature.u hover.u definition.u
SRC=launch-lsp.icn workspace.icn database.icn server.icn completion.icn signature.icn hover.icn \
definition.icn logger.icn
OBJ=launch-lsp.u workspace.u database.u server.u completion.u signature.u hover.u definition.u logger.u

export IPATH=$(UNI)/unidoc

Expand All @@ -19,11 +20,8 @@ $(prog): $(OBJ)
$(CP) $(prog)$(EXE) ../../bin

launch-lsp.u:launch-lsp.icn workspace.u database.u server.u completion.u signature.u hover.u definition.u
workspace.u:workspace.icn
database.u:database.icn
server.u:server.icn database.u completion.u workspace.u signature.u hover.u definition.u
completion.u:completion.icn
signature.u:signature.icn

server.u:server.icn database.u completion.u workspace.u signature.u hover.u definition.u logger.u
hover.u:hover.icn signature.u
definition.u: definition.icn hover.u

Expand Down
8 changes: 4 additions & 4 deletions uni/ulsp/database.icn
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ class LSPDB(
if \unicon_dir then
put(db_paths, unicon_dir || "ipl/procs", unicon_dir || "uni/unidoc")

Logger.debug1_class("db", "Looking in unicon paths")
Logger.debug1_kind("db", "Looking in unicon paths")
every dir := !db_paths do {
Logger.debug2_class("db:path", "Processing ", dir)
Logger.debug2_kind("db:path", "Processing ", dir)
build_by_path(dir)
}
end
Expand All @@ -129,15 +129,15 @@ class LSPDB(
x := idoc.packages

every pack := !x do {
Logger.debug3_class("db:path:package", "Processing ", pack.getName())
Logger.debug3_kind("db:path:package", "Processing ", pack.getName())

if /package_db[pack.getName()] then {
package_db[pack.getName()] := table()
package_db[pack.getName()]["files"] := table()
}

every file_in_pack := pack.getFiles().get() do {
Logger.debug4_class("db:path:package:file", "Processing ", file_in_pack.getName())
Logger.debug4_kind("db:path:package:file", "Processing ", file_in_pack.getName())
file_without_ext := &null
file_in_pack.getName() ? {
file_without_ext := tab(upto("."))
Expand Down
2 changes: 1 addition & 1 deletion uni/ulsp/launch-lsp.icn
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ procedure main(args)
Logger((opts["-loglevel"]), opts["-logfile"]) # # default to informational, stdout

if \opts["-debug-class"] then
Logger.add_debug_class(opts["-debug-class"])
Logger.add_debug_kind(opts["-debug-class"])

# Allow passing full host:port as an arg
sock := opts["-socket"]
Expand Down
Loading

0 comments on commit 765c8bb

Please sign in to comment.