Skip to content

Commit d0ebd09

Browse files
Copilotpardeike
andauthored
Document FileLog env variables
* Initial plan * Document HARMONY_NO_LOG and HARMONY_LOG_FILE environment variables for FileLog Co-authored-by: pardeike <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: pardeike <[email protected]>
1 parent 00602ef commit d0ebd09

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

Documentation/articles/basics.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ You can also use Harmony's file logger in your own code:
5050

5151
[!code-csharp[example](../examples/basics.cs?name=log)]
5252

53+
#### Controlling FileLog with Environment Variables
54+
55+
FileLog can be configured using environment variables:
56+
57+
- **`HARMONY_NO_LOG`**: Set to any non-empty value to disable file logging entirely.
58+
- **`HARMONY_LOG_FILE`**: Set to a custom file path to change where the log file is written.
59+
60+
Example:
61+
```bash
62+
# Disable logging
63+
export HARMONY_NO_LOG=1
64+
65+
# Or use a custom log path
66+
export HARMONY_LOG_FILE=/path/to/harmony.log.txt
67+
```
68+
5369
### Patching using annotations
5470

5571
If you prefer annotations to organize your patches, you instruct Harmony to search for them by using `PatchAll()`:

Documentation/articles/utilities.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,21 @@ public static void Reset()
7070
7171
public static unsafe void LogBytes(long ptr, int len)
7272
// Same as Log(string str) but logs a hex dump and md5 hash.
73+
```
74+
75+
#### Environment Variables
76+
77+
FileLog can be configured using the following environment variables:
78+
79+
- **`HARMONY_NO_LOG`**: Set this to any non-empty value to disable file logging entirely. When set, all logging calls will be silently ignored and no log file will be created.
80+
81+
- **`HARMONY_LOG_FILE`**: Set this to a custom file path to change where the log file is written. By default, the log file is created at `harmony.log.txt` on your Desktop. Setting this variable allows you to specify an alternative location.
82+
83+
Example usage:
84+
```bash
85+
# Disable logging
86+
export HARMONY_NO_LOG=1
87+
88+
# Or specify a custom log file path
89+
export HARMONY_LOG_FILE=/path/to/custom/harmony.log.txt
7390
```

0 commit comments

Comments
 (0)