Skip to content

Commit

Permalink
Merge pull request #52 from MaxandreOgeret/mog-dev-log
Browse files Browse the repository at this point in the history
set up logging
  • Loading branch information
MaxandreOgeret authored Jun 12, 2019
2 parents b933b17 + 1a6df00 commit b04fa38
Show file tree
Hide file tree
Showing 20 changed files with 690 additions and 172 deletions.
2 changes: 2 additions & 0 deletions Databases/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Empty file removed Safebrowsing/.gitignore
Empty file.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"ext-iconv": "*",
"ext-json": "*",
"friendsofsymfony/jsrouting-bundle": "^2.3",
"geoip2/geoip2": "~2.0",
"league/uri": "^5.3",
"league/uri-manipulations": "^1.5",
"league/uri-parser": "^1.4",
Expand All @@ -19,7 +20,7 @@
"symfony/framework-bundle": "^4.0",
"symfony/http-foundation": "^4.0",
"symfony/maker-bundle": "^1.3",
"symfony/monolog-bundle": "^3.1",
"symfony/monolog-bundle": "^3.3",
"symfony/orm-pack": "^1.0",
"symfony/process": "^4.0",
"symfony/security-bundle": "^4.0",
Expand Down
212 changes: 211 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions config/packages/dev/monolog.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
monolog:
channels: ['linksecurity', 'linkVisitDb', 'geo2ip']
handlers:
main:
type: stream
Expand All @@ -17,3 +18,20 @@ monolog:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]

linksecurity:
level: debug
type: rotating_file
path: '%kernel.logs_dir%/linksecurity.log'
channels: [linksecurity]
max_files: 5
geo2ip:
level: debug
type: rotating_file
path: '%kernel.logs_dir%/geo2ip.log'
channels: [geo2ip]
max_files: 5
linkVisitDb:
type: service
id: App\Util\MonologHandler\MonologLinkVisitHandler
channels: [linkVisitDb]
24 changes: 20 additions & 4 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ services:
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.

bind:
$rootDir: '%kernel.project_dir%'
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
Expand All @@ -28,9 +29,6 @@ services:
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

App\Command\UpdateBannedLinksCommand:
$rootDir: '%kernel.project_dir%'

App\Command\SafeBrowsingUpdateCommand:
$rootDir: '%kernel.project_dir%'

Expand All @@ -39,3 +37,21 @@ services:

App\Service\UserManager:
$locales: '%app.locales%'

App\Service\LinkManager:
$linkSecLogger: '@monolog.logger.linksecurity'

App\Service\Commands\SafebrowsingCmdManager:
$linkSecLogger: '@monolog.logger.linksecurity'

App\Repository\SBLinkRepository:
$linkSecLogger: '@monolog.logger.linksecurity'

App\Controller\LinkController:
$linkLogger: '@monolog.logger.linkVisitDb'

App\Command\Geo2ApiCommand:
$geo2IpLogger: '@monolog.logger.geo2ip'

App\Service\Geolocalization\Geo2IpManager:
$geo2IpLogger: '@monolog.logger.geo2ip'
Loading

0 comments on commit b04fa38

Please sign in to comment.