Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
132
Issues
132
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
b0cd4cda
Commit
b0cd4cda
authored
Jul 28, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging for DevEnv
parent
8cf8cbed
Pipeline
#4488
passed with stages
in 12 minutes and 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
EnvTypes.hs
src/Gargantext/API/Admin/EnvTypes.hs
+23
-0
Dev.hs
src/Gargantext/API/Dev.hs
+5
-3
No files found.
src/Gargantext/API/Admin/EnvTypes.hs
View file @
b0cd4cda
...
...
@@ -13,6 +13,7 @@ module Gargantext.API.Admin.EnvTypes (
,
env_manager
,
env_self_url
,
menv_firewall
,
dev_env_logger
,
MockEnv
(
..
)
,
DevEnv
(
..
)
...
...
@@ -233,9 +234,31 @@ data MockEnv = MockEnv
makeLenses
''
M
ockEnv
instance
MonadLogger
(
GargM
DevEnv
GargError
)
where
getLogger
=
asks
_dev_env_logger
instance
HasLogger
(
GargM
DevEnv
GargError
)
where
data
instance
Logger
(
GargM
DevEnv
GargError
)
=
GargDevLogger
{
dev_logger_mode
::
Mode
,
dev_logger_set
::
FL
.
LoggerSet
}
type
instance
LogInitParams
(
GargM
DevEnv
GargError
)
=
Mode
type
instance
LogPayload
(
GargM
DevEnv
GargError
)
=
FL
.
LogStr
initLogger
=
\
mode
->
do
dev_logger_set
<-
liftIO
$
FL
.
newStderrLoggerSet
FL
.
defaultBufSize
pure
$
GargDevLogger
mode
dev_logger_set
destroyLogger
=
\
GargDevLogger
{
..
}
->
liftIO
$
FL
.
rmLoggerSet
dev_logger_set
logMsg
=
\
(
GargDevLogger
mode
logger_set
)
lvl
msg
->
do
let
pfx
=
"["
<>
show
lvl
<>
"] "
when
(
lvl
`
elem
`
(
modeToLoggingLevels
mode
))
$
liftIO
$
FL
.
pushLogStrLn
logger_set
$
FL
.
toLogStr
pfx
<>
msg
logTxt
lgr
lvl
msg
=
logMsg
lgr
lvl
(
FL
.
toLogStr
$
T
.
unpack
msg
)
data
DevEnv
=
DevEnv
{
_dev_env_settings
::
!
Settings
,
_dev_env_config
::
!
GargConfig
,
_dev_env_logger
::
!
(
Logger
(
GargM
DevEnv
GargError
))
,
_dev_env_pool
::
!
(
Pool
Connection
)
,
_dev_env_nodeStory
::
!
NodeStoryEnv
,
_dev_env_mail
::
!
MailConfig
...
...
src/Gargantext/API/Dev.hs
View file @
b0cd4cda
...
...
@@ -29,16 +29,17 @@ import qualified Gargantext.Prelude.Mail as Mail
import
qualified
Gargantext.Prelude.NLP
as
NLP
import
Servant
import
System.IO
(
FilePath
)
import
Gargantext.System.Logging
type
IniPath
=
FilePath
-------------------------------------------------------------------
withDevEnv
::
IniPath
->
(
DevEnv
->
IO
a
)
->
IO
a
withDevEnv
iniPath
k
=
do
env
<-
newDevEnv
withDevEnv
iniPath
k
=
withLoggerHoisted
Dev
$
\
logger
->
do
env
<-
newDevEnv
logger
k
env
-- `finally` cleanEnv env
where
newDevEnv
=
do
newDevEnv
logger
=
do
cfg
<-
readConfig
iniPath
dbParam
<-
databaseParameters
iniPath
--nodeStory_env <- readNodeStoryEnv (_gc_repofilepath cfg)
...
...
@@ -49,6 +50,7 @@ withDevEnv iniPath k = do
nlp_config
<-
NLP
.
readConfig
iniPath
pure
$
DevEnv
{
_dev_env_pool
=
pool
,
_dev_env_logger
=
logger
,
_dev_env_nodeStory
=
nodeStory_env
,
_dev_env_settings
=
setts
,
_dev_env_config
=
cfg
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment