Skip to content

Commit e90dfd9

Browse files
committed
progress
1 parent ec81702 commit e90dfd9

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

crates/pgt_env/src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub struct PgLSEnv {
3838

3939
// DEPRECATED
4040
pub pgt_log_path: PgLSEnvVariable,
41+
pub pgt_log_level: PgLSEnvVariable,
4142
pub pgt_log_prefix: PgLSEnvVariable,
4243
pub pgt_config_path: PgLSEnvVariable,
4344
}
@@ -68,6 +69,10 @@ impl PgLSEnv {
6869
"PGT_LOG_PATH",
6970
"The directory where the Daemon logs will be saved. Deprecated, use PGLS_LOG_PATH instead.",
7071
),
72+
pgt_log_level: PgLSEnvVariable::new(
73+
"PGT_LOG_LEVEL",
74+
"Allows to change the log level. Default is debug. This will only affect \"pgt*\" crates. All others are logged with info level. Deprecated, use PGLS_LOG_LEVEL instead.",
75+
),
7176
pgt_log_prefix: PgLSEnvVariable::new(
7277
"PGT_LOG_PREFIX_NAME",
7378
"A prefix that's added to the name of the log. Default: `server.log`. Deprecated, use PGLS_LOG_PREFIX_NAME instead.",
@@ -123,6 +128,14 @@ impl Display for PgLSEnv {
123128
KeyValuePair(self.pgls_log_path.name, markup! {{DebugDisplay(value)}}).fmt(fmt)?;
124129
}
125130
};
131+
match self.pgls_log_level.value() {
132+
None => {
133+
KeyValuePair(self.pgls_log_level.name, markup! { <Dim>"unset"</Dim> }).fmt(fmt)?;
134+
}
135+
Some(value) => {
136+
KeyValuePair(self.pgls_log_level.name, markup! {{DebugDisplay(value)}}).fmt(fmt)?;
137+
}
138+
};
126139
match self.pgls_log_prefix.value() {
127140
None => {
128141
KeyValuePair(self.pgls_log_prefix.name, markup! { <Dim>"unset"</Dim> }).fmt(fmt)?;
@@ -152,6 +165,14 @@ impl Display for PgLSEnv {
152165
KeyValuePair(self.pgt_log_path.name, markup! {{DebugDisplay(value)}}).fmt(fmt)?;
153166
}
154167
};
168+
match self.pgt_log_level.value() {
169+
None => {
170+
KeyValuePair(self.pgt_log_level.name, markup! { <Dim>"unset"</Dim> }).fmt(fmt)?;
171+
}
172+
Some(value) => {
173+
KeyValuePair(self.pgt_log_level.name, markup! {{DebugDisplay(value)}}).fmt(fmt)?;
174+
}
175+
};
155176
match self.pgt_log_prefix.value() {
156177
None => {
157178
KeyValuePair(self.pgt_log_prefix.name, markup! { <Dim>"unset"</Dim> }).fmt(fmt)?;

docs/codegen/src/env_variables.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ pub fn generate_env_variables(docs_dir: &Path) -> Result<()> {
2020
env.pgls_log_path.name(),
2121
env.pgls_log_path.description()
2222
)?;
23+
writeln!(
24+
content,
25+
"### `{}`\n\n {}\n",
26+
env.pgls_log_level.name(),
27+
env.pgls_log_level.description()
28+
)?;
2329
writeln!(
2430
content,
2531
"### `{}`\n\n {}\n",
@@ -38,6 +44,12 @@ pub fn generate_env_variables(docs_dir: &Path) -> Result<()> {
3844
env.pgt_log_path.name(),
3945
env.pgt_log_path.description()
4046
)?;
47+
writeln!(
48+
content,
49+
"### `{}`\n\n {}\n",
50+
env.pgt_log_level.name(),
51+
env.pgt_log_level.description()
52+
)?;
4153
writeln!(
4254
content,
4355
"### `{}`\n\n {}\n",

docs/reference/env_variables.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
The directory where the Daemon logs will be saved.
99

10+
### `PGLS_LOG_LEVEL`
11+
12+
Allows to change the log level. Default is debug. This will only affect "pgt*" crates. All others are logged with info level.
13+
1014
### `PGLS_LOG_PREFIX_NAME`
1115

1216
A prefix that's added to the name of the log. Default: `server.log.`
@@ -19,6 +23,10 @@
1923

2024
The directory where the Daemon logs will be saved. Deprecated, use PGLS_LOG_PATH instead.
2125

26+
### `PGT_LOG_LEVEL`
27+
28+
Allows to change the log level. Default is debug. This will only affect "pgt*" crates. All others are logged with info level. Deprecated, use PGLS_LOG_LEVEL instead.
29+
2230
### `PGT_LOG_PREFIX_NAME`
2331

2432
A prefix that's added to the name of the log. Default: `server.log`. Deprecated, use PGLS_LOG_PREFIX_NAME instead.

0 commit comments

Comments
 (0)