Skip to content

Commit 56871cd

Browse files
committed
fix env and default mode
1 parent 36191b6 commit 56871cd

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

.env.example

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ SUPABASE_ANON_KEY=
1818
# Comma separated list of remote character urls (optional)
1919
REMOTE_CHARACTER_URLS=
2020

21+
# Logging
22+
LOG_JSON_FORMAT= # Print everything in logger as json; false by default
23+
2124
###############################
2225
#### Client Configurations ####
2326
###############################
@@ -627,5 +630,3 @@ INSTAGRAM_POST_INTERVAL_MAX=120 # Default: 120 minutes
627630
INSTAGRAM_ENABLE_ACTION_PROCESSING=false # Enable/disable action processing
628631
INSTAGRAM_ACTION_INTERVAL=5 # Interval between actions in minutes
629632
INSTAGRAM_MAX_ACTIONS=1 # Maximum number of actions to process at once
630-
631-
LOG_JSON_FORMAT= # Print everything in logger as json

packages/core/src/logger.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const customLevels: Record<string, number> = {
1313
trace: 10,
1414
};
1515

16-
const raw = process?.env?.LOG_JSON_FORMAT ? true : false;
16+
const raw = process?.env?.LOG_JSON_FORMAT || false;
1717

1818
const createStream = () => {
1919
if (raw) {
@@ -36,20 +36,22 @@ const options = {
3636
const [arg1, ...rest] = inputArgs;
3737

3838
if (typeof arg1 === "object") {
39-
const messageParts = rest.map(arg =>
39+
const messageParts = rest.map((arg) =>
4040
typeof arg === "string" ? arg : JSON.stringify(arg)
4141
);
4242
const message = messageParts.join(" ");
4343
return method.apply(this, [arg1, message]);
4444
} else {
4545
const context = {};
46-
const messageParts = [arg1, ...rest].map(arg =>
46+
const messageParts = [arg1, ...rest].map((arg) =>
4747
typeof arg === "string" ? arg : arg
4848
);
4949
const message = messageParts
50-
.filter(part => typeof part === "string")
50+
.filter((part) => typeof part === "string")
5151
.join(" ");
52-
const jsonParts = messageParts.filter(part => typeof part === "object");
52+
const jsonParts = messageParts.filter(
53+
(part) => typeof part === "object"
54+
);
5355

5456
Object.assign(context, ...jsonParts);
5557

0 commit comments

Comments
 (0)