csys: test logging facility, +config: log to file

This commit is contained in:
Helmut Merz 2026-04-24 07:41:43 +02:00
parent 6318b80196
commit a452a877dd
5 changed files with 26 additions and 17 deletions

20
.gitignore vendored
View file

@ -1,23 +1,11 @@
# The directory Mix will write compiled artifacts to.
/_build/ /_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/ /cover/
# The directory Mix downloads your dependencies sources to.
/deps/ /deps/
# Where third-party dependencies like ExDoc output generated docs.
/doc/ /doc/
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez *.ez
scopes-*.tar
# Ignore package tarball (built via "mix hex.build").
xplore-*.tar
# Temporary files, for example, from tests.
/tmp/ /tmp/
log/
.env

10
config/config.exs Normal file
View file

@ -0,0 +1,10 @@
# scopes: basic config file
import Config
config :logger, :default_handler,
config: [
file: ~c"log/scopes.log"
]
import_config "#{config_env()}.exs"

8
config/test.exs Normal file
View file

@ -0,0 +1,8 @@
# scopes: config file for testing
import Config
config :logger, :default_handler,
config: [
file: ~c"test/log/scopes_test.log"
]

View file

@ -1,7 +1,11 @@
defmodule Scopes.CSys do defmodule Scopes.CSys do
require Logger
alias Scopes.Core.Actor alias Scopes.Core.Actor
def neuron(scope) do def neuron(scope) do
#Logger.info("create neuron, scope: #{inspect scope}")
Logger.info([info: "create neuron", scope: inspect(scope)])
Actor.create(fn msg -> process(msg, scope) end) Actor.create(fn msg -> process(msg, scope) end)
end end

View file

@ -29,5 +29,4 @@ defmodule Scopes.CSys.Programs do
def std_proc(msg, scope) do def std_proc(msg, scope) do
unless forward(msg, scope), do: notify(msg, scope) unless forward(msg, scope), do: notify(msg, scope)
end end
end end