Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- The DLS will now correctly report missing template names in 'in each' constructs
- Fixed error where the DLS would fail to match references from within in a template
to symbols defined in parents of objects instantiating the template
- Added environment variable to control max per-log output length for most logging from the DLS, defaulting to 1000 characters.

## 0.9.17
- Fixed linter wrongly throwing an error on space after `defined` keyword
Expand Down
3 changes: 3 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ instantiated.
including direct instantiation sites (so this is a super-set of
`goto-implementations`)

## Relevant environment variables
* `MAX_LOG_MESSAGE_LENGTH` When set, will truncate any outputted logs that are longer than the value. Defaults to 1000 bytes. Set to 0 to turn off truncation.

## In-Line Linting Configuration
It may be desireable to control linting on a per-file basis, rather than
relying on the linting configuration. This can be done with in-line
Expand Down
2 changes: 1 addition & 1 deletion src/actions/analysis_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::file_management::CanonPath;
use crate::vfs::{TextFile, Vfs};
use crate::server::ServerToHandle;

use log::{info, debug, trace, error};
use crate::logging::{info, debug, trace, error};
use crossbeam::channel;

// Maps in-process device jobs the timestamps of their dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/actions/analysis_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 and MIT
//! Stores currently completed analysis.

use log::{debug, info, trace};
use crate::logging::{debug, trace, info};

use crossbeam::channel;

Expand Down
2 changes: 1 addition & 1 deletion src/actions/hover.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
use log::*;
use crate::logging::*;

use crate::span::{Range, ZeroIndexed};
use serde::{Deserialize, Serialize};
Expand Down
6 changes: 3 additions & 3 deletions src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! Actions that the DLS can perform: responding to requests, watching files,
//! etc.

use log::{debug, info, trace, error, warn};
use thiserror::Error;
use crossbeam::channel;
use serde::Deserialize;
Expand Down Expand Up @@ -40,6 +39,7 @@ use crate::Span;
use crate::span;
use crate::span::{ZeroIndexed, FilePosition};
use crate::vfs::Vfs;
use crate::logging::{debug, info, trace, error};

use jsonrpc::error::{standard_error, StandardError};
use serde_json::Value;
Expand Down Expand Up @@ -80,7 +80,7 @@ macro_rules! make_canon_path {
macro_rules! ignore_non_file_uri {
($expr: expr, $uri: expr, $log_name: expr) => {
$expr.map_err(|_| {
log::trace!("{}: Non-`file` URI scheme, ignoring: {:?}", $log_name, $uri);
crate::logging::trace!("{}: Non-`file` URI scheme, ignoring: {:?}", $log_name, $uri);
})
};
}
Expand Down Expand Up @@ -594,7 +594,7 @@ impl <O: Output> InitActionContext<O> {
.extend(includes.into_iter());
}
} else {
warn!(
info!(
"File in compile information file is not .dml; \
{:?}",
file
Expand Down
4 changes: 2 additions & 2 deletions src/actions/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use crate::file_management::CanonPath;
use crate::span::{Span};
use crate::vfs::{Change, VfsSpan};
use crate::lsp_data::*;
use crate::logging::{debug, error};

use jsonrpc::error::StandardError;
use log::{debug, error, warn};
use serde::{Serialize, Deserialize};

use lsp_types::notification::ShowMessage;
Expand Down Expand Up @@ -211,7 +211,7 @@ impl BlockingNotificationAction for DidChangeConfiguration {
let new_config = match settings {
Ok(value) => value.dml,
Err(err) => {
warn!("Received unactionable config: {:?} (error: {:?})", params.settings, err);
error!("Received unactionable config: {:?} (error: {:?})", params.settings, err);
return Err(().into());
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/actions/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! Requests that the DLS can respond to.

use jsonrpc::error::StandardError;
use log::{debug, error, info, trace, warn};
use serde::{Deserialize, Serialize};

use std::collections::HashSet;
Expand All @@ -19,6 +18,7 @@ use crate::actions::semantic_lookup::{DLSLimitation, declarations_at_fp, definit
use crate::analysis::{Named, DeclarationSpan, LocationSpan};
use crate::analysis::symbols::SimpleSymbol;
use crate::config::Config;
use crate::logging::{debug, error, info, trace};

pub use crate::lsp_data::request::{
ApplyWorkspaceEdit,
Expand Down Expand Up @@ -65,17 +65,17 @@ fn warn_miss_lookup(error: AnalysisLookupError, file: Option<&str>) {
if let Some(f) = file { f.to_string() }
else { "the opened file".to_string() }),
AnalysisLookupError::NoIsolatedAnalysis =>
warn!(
info!(
"No syntactical analysis available{}",
if let Some(f) = file { format!(" for the file '{}'", f) }
else { "".to_string() }),
AnalysisLookupError::NoLintAnalysis =>
warn!(
info!(
"No linting analysis available{}",
if let Some(f) = file { format!(" for the file '{}'", f) }
else { "".to_string() }),
AnalysisLookupError::NoDeviceAnalysis =>
warn!(
info!(
"No semantic analysis available{}, may need to open a file \
with a 'device' declaration that imports{}, directly or \
indirectly.",
Expand Down Expand Up @@ -985,8 +985,8 @@ impl SentRequest for WorkspaceConfiguration {
let new_config = match settings {
Ok(value) => value,
Err(err) => {
warn!("Received unactionable config: {:?} (error: {:?})",
&response, err);
error!("Received unactionable config: {:?} (error: {:?})",
&response, err);
return;
}
};
Expand Down
7 changes: 4 additions & 3 deletions src/actions/work_pool.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
use crate::server::DEFAULT_REQUEST_TIMEOUT;
use crate::logging::{info, error};

use lazy_static::lazy_static;
use log::{info, warn};
use std::sync::{mpsc, Mutex};
use std::time::{Duration, Instant};
use std::{fmt, panic};
Expand Down Expand Up @@ -62,7 +63,7 @@ where
if work.len() >= *NUM_THREADS {
// there are already N ongoing tasks, that may or may not have timed out
// don't add yet more to the queue fail fast to allow the work pool to recover
warn!("Could not start `{}` as at work capacity, {:?} in progress", description, *work,);
error!("Could not start `{}` as at work capacity, {:?} in progress", description, *work,);
return receiver;
}
if work.iter().filter(|desc| *desc == &description).count() >= MAX_SIMILAR_CONCURRENT_WORK {
Expand Down Expand Up @@ -96,7 +97,7 @@ where
if elapsed >= *WARN_TASK_DURATION {
let secs =
elapsed.as_secs() as f64 + f64::from(elapsed.subsec_nanos()) / 1_000_000_000_f64;
warn!("`{}` took {:.1}s", description, secs);
info!("`{}` took {:.1}s", description, secs);
}
});
receiver
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::sync::Mutex;

use lsp_types::{DiagnosticSeverity};
use logos::Logos;
use log::{debug, error, info, trace};
use crate::logging::{debug, error, info, trace};
use rayon::prelude::*;

use crate::actions::SourcedDMLError;
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/parsing/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 and MIT
use logos::Lexer;
use regex::Regex;
use log::trace;
use crate::logging::trace;
use lazy_static::lazy_static;

use crate::span::{Range, ZeroIndexed, Position};
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/parsing/statement.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
use log::error;
use crate::logging::error;

use crate::lint::rules::indentation::{IndentEmptyLoopArgs,
IndentContinuationLineArgs};
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/parsing/structure.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
// Types, traits, and structs for the structure of a DML file
use log::{trace};
use crate::logging::{trace};

use crate::analysis::parsing::expression::{Expression,
ensure_string_concatenation};
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::analysis::reference::{Reference};

use crate::analysis::structure::objects::Method;

use log::{debug, trace};
use crate::logging::{debug, trace};

pub trait Scope : DeclarationSpan + Named {
// Need this to create default mappings
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/structure/expressions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
use log::{error};
use crate::logging::{error};

use std::num::{IntErrorKind, ParseIntError};

Expand Down
2 changes: 1 addition & 1 deletion src/analysis/structure/statements.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
use log::error;
use crate::logging::error;

use crate::analysis::{DeclarationSpan,
LocalDMLError};
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/structure/toplevel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::fmt::{Display, Formatter, self as fmt};
use std::path::PathBuf;

use log::trace;
use crate::logging::trace;

use crate::analysis::structure::objects::{Bitorder, CBlock, CompositeObject,
CompObjectKind, Constant, Device,
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/templating/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::collections::{HashMap, HashSet};
use std::iter;
use std::sync::Arc;

use log::{debug, trace, error};
use crate::logging::{debug, trace, error};
use lsp_types::DiagnosticSeverity;
use slotmap::{DefaultKey, Key, SlotMap};

Expand Down
2 changes: 1 addition & 1 deletion src/analysis/templating/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::Mutex;

use itertools::Itertools;
use lazy_static::lazy_static;
use log::{debug, error, trace};
use crate::logging::{debug, error, trace};
use lsp_types::DiagnosticSeverity;

use crate::analysis::DeclarationSpan;
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/templating/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::analysis::templating::topology::Rank;

use crate::analysis::DeclarationSpan;

use log::{debug, error, trace};
use crate::logging::{debug, error, trace};
use lsp_types::DiagnosticSeverity;

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use std::time::{Duration, Instant};
use serde_json;
use lazy_static::lazy_static;

use log::debug;
use crate::logging::debug;

/// Runs the DLS in command line mode.
pub fn run(compile_info_path: Option<PathBuf>,
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::path::PathBuf;
use serde::de::Deserializer;
use serde::{Deserialize, Serialize};

use log::{error, trace};
use crate::logging::{error, trace};

use crate::lsp_data::SerializeError;

Expand Down
2 changes: 1 addition & 1 deletion src/dfa/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::server::{self, Notification};
use crate::cmd;
use crate::lsp_data::{parse_file_path, parse_uri};

use log::{debug, trace};
use crate::logging::{debug, trace};

#[derive(Debug, PartialEq)]
pub struct Diagnostic {
Expand Down
2 changes: 0 additions & 2 deletions src/dfa/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ use subprocess::ExitStatus;
use clap::{command, arg, Arg, ArgAction};

use dls::dfa::ClientInterface;


use log::debug;

pub fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/file_management.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// © 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 and MIT
//! Contains utilities and file management
use log::{debug, error, trace};
use crate::logging::{debug, error, trace};

use std::collections::HashMap;
use std::fs;
Expand Down
2 changes: 1 addition & 1 deletion src/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use lazy_static::lazy_static;
use log::{debug, error, trace};
use crate::logging::{debug, error, trace};
use rules::linelength::{BreakBeforeBinaryOpOptions,
BreakFuncCallOpenParenOptions,
BreakMethodOutputOptions,
Expand Down
Loading