You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.9 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Logchecker
  2. A CD rip logchecker, used for analyzing the generated logs for any problems that would potentially
  3. indicate a non-perfect rip was produced. Of course, just because a log doesn't score a perfect 100%
  4. does not mean that the produced rip isn't bit perfect, it's just less likely. While this library can
  5. largely run on both Linux and Windows, validating of checksums is only really supported for Linux.
  6. While this library will analyze most parts of a log, unfortunately it cannot properly validate the checksums
  7. for all types of logs. This is due to creators of these programs making their logchecker closed source
  8. and involves some amount of custom mathematical work to produce it. Therefore, we have to fallback on
  9. external methods to validate the checksums of EAC and XLD. If the logchecker detects that we do not have
  10. the necessary programs, then we will just skip this external step and assume the checksum is valid. For
  11. setting up the necessary programs to validate the checksum, see below for the given program you care about.
  12. ## Requirements
  13. * PHP 7.0+
  14. ## Optional Requirements
  15. * Python 3.5+
  16. * [cchardet](https://github.com/PyYoshi/cChardet) (or [chardet](https://github.com/chardet/chardet))
  17. * [eac_logchecker.py](https://github.com/OPSnet/eac_logchecker.py)
  18. * [xld_logchecker.py](https://github.com/OPSnet/xld_logchecker.py)
  19. ```bash
  20. pip3 install chardet eac-logchecker xld-logchecker
  21. ```
  22. ## Standalone
  23. ### Installation
  24. Go to our [releases](https://github.com/OPSnet/Logchecker/releases) and grab the logchecker.phar
  25. file. Download this file, and then it can executed via CLI by running `php logchecker.phar`.
  26. Alternatively, if you `chmod +x logchecker.phar`, it can be executed directly by doing `./logchecker.phar`.
  27. To install it globally, run:
  28. ```bash
  29. mv logchecker.phar /usr/local/bin/logchecker
  30. chmod +x /usr/local/bin/logchecker
  31. ```
  32. ### Usage
  33. ```
  34. $ logchecker --help
  35. Usage:
  36. analyze [options] [--] <file>
  37. Arguments:
  38. file Log file to analyze
  39. Options:
  40. --output Print the HTML log text
  41. -h, --help Display this help message
  42. -q, --quiet Do not output any message
  43. -V, --version Display this application version
  44. --ansi Force ANSI output
  45. --no-ansi Disable ANSI output
  46. -n, --no-interaction Do not ask any interactive question
  47. -file, --out=OUT File to write HTML log text to
  48. -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  49. Help:
  50. This command analyzes a log file
  51. $ logchecker tests/logs/wgdbcm.log
  52. Score : 57
  53. Checksum: checksum_missing
  54. Details :
  55. [Notice] Translated log from Русский (Russian) to English.
  56. EAC version older than 0.99 (-30 points)
  57. Could not verify read mode (-1 point)
  58. Could not verify read offset (-1 point)
  59. Could not verify null samples
  60. Could not verify gap handling (-10 points)
  61. Could not verify id3 tag setting (-1 point)
  62. ```
  63. ### Code
  64. ```php
  65. <?php
  66. $logchecker = new OrpheusNET\Logchecker\Logchecker();
  67. $logchecker->add_file('path/to/file.log');
  68. list($score, $details, $checksum_state, $log_text) = $logchecker->parse();
  69. ```
  70. ## Library Usage
  71. ### Installation
  72. ```
  73. $ composer require orpheusnet/logchecker
  74. ```
  75. ### Usage
  76. ```php
  77. <?php
  78. require __DIR__ . '/vendor/autoload.php';
  79. use OrpheusNET\Logchecker\Logchecker;
  80. $logchecker = new Logchecker();
  81. $logchecker->new_file('/path/to/log/file');
  82. list($score, $details, $checksum_state, $log_text) = $logchecker->parse();
  83. print('Score: ' . $score . "\n");
  84. print('Checksum: ' . $checksum_state . "\n");
  85. print("\nDetails:\n");
  86. foreach ($details as $detail) {
  87. print(" {$detail}\n");
  88. }
  89. print("\nLog Text:\n{$log_text}");
  90. ```
  91. ## Building
  92. To build your own phar, you can checkout this repository, and then
  93. run the `bin/compile` script. To do this, run the following commands:
  94. ```bash
  95. git clone https://github.com/OPSnet/Logchecker
  96. cd Logchecker
  97. composer install
  98. php -d phar.readonly=0 bin/compile
  99. ```