Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Enhanced Ground Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Enhanced Ground Software
Commits
c54fbc5a
Commit
c54fbc5a
authored
2 months ago
by
Federico Lolli
Browse files
Options
Downloads
Patches
Plain Diff
fixed issue with not logging
parent
192406b4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.rs
+18
-14
18 additions, 14 deletions
src/main.rs
with
18 additions
and
14 deletions
src/main.rs
+
18
−
14
View file @
c54fbc5a
...
...
@@ -23,29 +23,33 @@ static MAVLINK_PROFILE: LazyLock<ReflectionContext> = LazyLock::new(ReflectionCo
static
APP_NAME
:
&
str
=
"segs"
;
fn
main
()
->
Result
<
(),
eframe
::
Error
>
{
// Set up logging (USE RUST_LOG=debug to see logs)
let
env_filter
=
EnvFilter
::
builder
()
.from_env_lossy
();
let
registry
=
tracing_subscriber
::
registry
()
.with
(
tracing_subscriber
::
fmt
::
layer
()
.with_filter
(
env_filter
));
// Create the logs directory if it doesn't exist and add to the registry
if
let
Some
(
base_dirs
)
=
directories
::
BaseDirs
::
new
()
{
let
mut
_guard
=
None
;
let
file_layer
=
if
let
Some
(
base_dirs
)
=
directories
::
BaseDirs
::
new
()
{
let
proj_dir
=
base_dirs
.data_local_dir
()
.join
(
APP_NAME
);
let
logs_dir
=
proj_dir
.join
(
"logs"
);
create_dir_all
(
&
logs_dir
)
.log_expect
(
"Failed to create logs directory"
);
let
file_appender
=
tracing_appender
::
rolling
::
daily
(
logs_dir
,
"segs.log"
);
let
(
non_blocking
,
_guard
)
=
tracing_appender
::
non_blocking
(
file_appender
);
let
registry
=
registry
.with
(
let
file_appender
=
tracing_appender
::
rolling
::
daily
(
&
logs_dir
,
"segs.log"
);
let
(
non_blocking
,
guard
)
=
tracing_appender
::
non_blocking
(
file_appender
);
_guard
=
Some
(
guard
);
// Keep guard alive to flush logs
Some
(
tracing_subscriber
::
fmt
::
layer
()
.json
()
.with_writer
(
non_blocking
),
);
// Initialize the logger
registry
.init
();
)
}
else
{
registry
.init
();
}
None
};
// Set up logging (USE RUST_LOG=debug to see logs)
let
env_filter
=
EnvFilter
::
builder
()
.from_env_lossy
();
// Initialize the logger
tracing_subscriber
::
registry
()
.with
(
tracing_subscriber
::
fmt
::
layer
()
.with_filter
(
env_filter
))
.with
(
file_layer
)
.init
();
let
native_options
=
eframe
::
NativeOptions
{
// By modifying the viewport, we can change things like the windows size
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment