Bug 244407 - We should use Options::useOSLog to trigger initializeDatafileToUseOSLog
Summary: We should use Options::useOSLog to trigger initializeDatafileToUseOSLog
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-08-26 12:47 PDT by Yijia Huang
Modified: 2022-09-02 12:48 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yijia Huang 2022-08-26 12:47:43 PDT
The current implementation to initializeDatafileToUseOSLog is based on useOSLogOptionHasChanged, which is inconvenient for some cases due to useOSLogOptionHasChanged can only be updated in std::optional<OptionsStorage::OSLogType> parse(const char* string) with condition `result && result.value() != Options::useOSLog()`.

```
    if (useOSLogOptionHasChanged) {
        initializeDatafileToUseOSLog();
        useOSLogOptionHasChanged = false;
    }
```

```
    if (result && result.value() != Options::useOSLog()) {
        useOSLogOptionHasChanged = true;
    }
```

That means we only can trigger initializeDatafileToUseOSLog() by passing an environment variable other than useOSLog::None. So, the following cases would fail to trigger the initialization function:
case 1: change OSLogType::None to OSLogType::Error in OptionsList.h and pass an environment variable `useOSLog=1`
case 2: only change OSLogType::None to OSLogType::Error in OptionsList.h

We can resolve this by using this
```
    if (Options::useOSLog() != OSLogType::None)
        initializeDatafileToUseOSLog();
```
Comment 1 Radar WebKit Bug Importer 2022-09-02 12:48:19 PDT
<rdar://problem/99500809>